gyk
This commit is contained in:
commit
0f8134ddb2
0
.tgitconfig
Normal file
0
.tgitconfig
Normal file
139
gyk.log
Normal file
139
gyk.log
Normal file
@ -0,0 +1,139 @@
|
||||
2023-12-04 07:52:40.656 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701647560656 sessioncount 0
|
||||
2023-12-04 07:52:40.659 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 3 expired sessions: 0
|
||||
2023-12-04 07:52:47.783 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:52:47.783 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:52:47.784 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Add connection elided, waiting 0, queue 1
|
||||
2023-12-04 07:52:47.784 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Add connection elided, waiting 0, queue 1
|
||||
2023-12-04 07:52:47.784 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Add connection elided, waiting 0, queue 1
|
||||
2023-12-04 07:52:47.784 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Add connection elided, waiting 0, queue 1
|
||||
2023-12-04 07:52:47.784 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Add connection elided, waiting 0, queue 1
|
||||
2023-12-04 07:52:47.784 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Add connection elided, waiting 0, queue 1
|
||||
2023-12-04 07:52:47.784 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Add connection elided, waiting 0, queue 1
|
||||
2023-12-04 07:52:47.784 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Add connection elided, waiting 0, queue 1
|
||||
2023-12-04 07:52:47.791 [master connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - master - Closing connection com.mysql.cj.jdbc.ConnectionImpl@b9611e9: (connection has passed maxLifetime)
|
||||
2023-12-04 07:52:47.792 [master connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - master - Closing connection com.mysql.cj.jdbc.ConnectionImpl@4aab1bd2: (connection has passed maxLifetime)
|
||||
2023-12-04 07:52:47.792 [master connection closer] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:52:47.793 [master connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - master - Closing connection com.mysql.cj.jdbc.ConnectionImpl@21e64e6: (connection has passed maxLifetime)
|
||||
2023-12-04 07:52:47.793 [master connection closer] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:52:47.793 [master connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - master - Closing connection com.mysql.cj.jdbc.ConnectionImpl@15139178: (connection has passed maxLifetime)
|
||||
2023-12-04 07:52:47.794 [master connection closer] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:52:47.794 [master connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - master - Closing connection com.mysql.cj.jdbc.ConnectionImpl@7782cfa2: (connection has passed maxLifetime)
|
||||
2023-12-04 07:52:47.794 [master connection closer] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:52:47.794 [master connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - master - Closing connection com.mysql.cj.jdbc.ConnectionImpl@220800cf: (connection has passed maxLifetime)
|
||||
2023-12-04 07:52:47.794 [master connection closer] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:52:47.794 [master connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - master - Closing connection com.mysql.cj.jdbc.ConnectionImpl@63350af4: (connection has passed maxLifetime)
|
||||
2023-12-04 07:52:47.795 [master connection closer] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:52:47.795 [master connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - master - Closing connection com.mysql.cj.jdbc.ConnectionImpl@521c2bd6: (connection has passed maxLifetime)
|
||||
2023-12-04 07:52:47.795 [master connection closer] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:52:47.795 [master connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - master - Closing connection com.mysql.cj.jdbc.ConnectionImpl@4dabfd1b: (connection has passed maxLifetime)
|
||||
2023-12-04 07:52:47.796 [master connection closer] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:52:47.796 [master connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - master - Closing connection com.mysql.cj.jdbc.ConnectionImpl@427a6de5: (connection has passed maxLifetime)
|
||||
2023-12-04 07:52:47.796 [master connection closer] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:52:53.946 [master connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Added connection com.mysql.cj.jdbc.ConnectionImpl@6ce588a0
|
||||
2023-12-04 07:53:00.090 [master connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Added connection com.mysql.cj.jdbc.ConnectionImpl@2dd8829b
|
||||
2023-12-04 07:53:06.237 [master connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Added connection com.mysql.cj.jdbc.ConnectionImpl@1c3f88cd
|
||||
2023-12-04 07:53:12.378 [master connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Added connection com.mysql.cj.jdbc.ConnectionImpl@4df77dd4
|
||||
2023-12-04 07:53:17.792 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=4, active=0, idle=4, waiting=0)
|
||||
2023-12-04 07:53:17.792 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:53:18.522 [master connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Added connection com.mysql.cj.jdbc.ConnectionImpl@ccbaf68
|
||||
2023-12-04 07:53:24.667 [master connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Added connection com.mysql.cj.jdbc.ConnectionImpl@49b9449a
|
||||
2023-12-04 07:53:30.811 [master connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Added connection com.mysql.cj.jdbc.ConnectionImpl@65a9cb3f
|
||||
2023-12-04 07:53:36.955 [master connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Added connection com.mysql.cj.jdbc.ConnectionImpl@6dd1f17b
|
||||
2023-12-04 07:53:40.721 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701647620721 sessioncount 0
|
||||
2023-12-04 07:53:40.721 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 07:53:43.100 [master connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Added connection com.mysql.cj.jdbc.ConnectionImpl@36a3ffc9
|
||||
2023-12-04 07:53:47.805 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=9, active=0, idle=9, waiting=0)
|
||||
2023-12-04 07:53:47.805 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:53:49.244 [master connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Added connection com.mysql.cj.jdbc.ConnectionImpl@45e8790c
|
||||
2023-12-04 07:54:17.817 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:54:17.817 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:54:40.770 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701647680770 sessioncount 0
|
||||
2023-12-04 07:54:40.770 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 07:54:47.821 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:54:47.821 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:55:17.823 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:55:17.823 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:55:40.813 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701647740813 sessioncount 0
|
||||
2023-12-04 07:55:40.814 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 1 expired sessions: 0
|
||||
2023-12-04 07:55:47.831 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:55:47.831 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:56:17.831 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:56:17.831 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:56:40.855 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701647800855 sessioncount 0
|
||||
2023-12-04 07:56:40.855 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 07:56:47.836 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:56:47.836 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:57:17.843 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:57:17.843 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:57:40.887 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701647860887 sessioncount 0
|
||||
2023-12-04 07:57:40.887 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 07:57:47.857 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:57:47.857 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:58:17.871 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:58:17.871 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:58:40.959 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701647920959 sessioncount 0
|
||||
2023-12-04 07:58:40.959 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 07:58:47.875 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:58:47.875 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:59:17.884 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:59:17.884 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 07:59:41.016 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701647981016 sessioncount 0
|
||||
2023-12-04 07:59:41.016 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 07:59:47.892 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 07:59:47.892 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:00:17.901 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:00:17.901 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:00:41.060 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701648041060 sessioncount 0
|
||||
2023-12-04 08:00:41.060 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 08:00:47.902 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:00:47.902 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:01:17.914 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:01:17.914 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:01:41.112 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701648101112 sessioncount 0
|
||||
2023-12-04 08:01:41.113 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 08:01:47.917 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:01:47.917 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:02:17.929 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:02:17.929 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:02:41.155 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701648161155 sessioncount 0
|
||||
2023-12-04 08:02:41.155 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 08:02:47.935 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:02:47.935 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:03:17.950 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:03:17.950 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:03:41.199 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701648221199 sessioncount 0
|
||||
2023-12-04 08:03:41.200 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 08:03:47.952 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:03:47.952 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:04:17.966 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:04:17.966 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:04:41.260 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701648281260 sessioncount 0
|
||||
2023-12-04 08:04:41.260 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 08:04:47.969 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:04:47.969 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:05:17.976 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:05:17.976 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:05:41.320 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701648341320 sessioncount 0
|
||||
2023-12-04 08:05:41.320 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 08:05:47.979 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:05:47.979 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:06:17.987 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:06:17.987 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:06:41.356 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701648401356 sessioncount 0
|
||||
2023-12-04 08:06:41.356 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 08:06:48.000 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:06:48.000 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:07:18.002 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:07:18.002 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:07:41.430 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701648461430 sessioncount 0
|
||||
2023-12-04 08:07:41.430 [Catalina-utility-2] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 08:07:48.007 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:07:48.007 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:08:18.014 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:08:18.014 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:08:41.463 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - Start expire sessions StandardManager at 1701648521463 sessioncount 0
|
||||
2023-12-04 08:08:41.463 [Catalina-utility-1] DEBUG org.apache.catalina.session.ManagerBase - End expire sessions StandardManager processingTime 0 expired sessions: 0
|
||||
2023-12-04 08:08:48.028 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:08:48.028 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
||||
2023-12-04 08:09:18.037 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2023-12-04 08:09:18.037 [master housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - master - Fill pool skipped, pool is at sufficient level.
|
256
pom.xml
Normal file
256
pom.xml
Normal file
@ -0,0 +1,256 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>CxcBoot</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.0.RELEASE</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<!-- 若想引用modbus4j需要引入下列repository id:ias-snapshots id:ias-releases 两个 -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<id>ias-snapshots</id>
|
||||
<name>Infinite Automation Snapshot Repository</name>
|
||||
<url>https://maven.mangoautomation.net/repository/ias-snapshot/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<id>ias-releases</id>
|
||||
<name>Infinite Automation Release Repository</name>
|
||||
<url>https://maven.mangoautomation.net/service/rest/repository/browse/ias-release/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.serotonin</groupId>-->
|
||||
<!-- <artifactId>modbus4j</artifactId>-->
|
||||
<!-- <version>1.0</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${pom.basedir}/src/main/resources/modbus/modbus4J.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- modbus协议 -->
|
||||
<dependency>
|
||||
<groupId>com.infiniteautomation</groupId>
|
||||
<artifactId>modbus4j</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
<!-- modbus相关-->
|
||||
<dependency>
|
||||
<groupId>org.scream3r</groupId>
|
||||
<artifactId>jssc</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.serotonin</groupId>-->
|
||||
<!-- <artifactId>modbus4j</artifactId>-->
|
||||
<!-- <version>1.0</version>-->
|
||||
<!-- <scope>system</scope>-->
|
||||
<!-- <systemPath>${pom.basedir}/src/main/resources/modbus/modbus4J.jar</systemPath>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.serotonin</groupId>
|
||||
<artifactId>seroUntils</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${pom.basedir}/src/main/resources/modbus/seroUtils.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
<version>3.3.9</version>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.15</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!--execl依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.khapi</groupId>
|
||||
<artifactId>khapi</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${pom.basedir}/src/main/resources/lib/khapi.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<!-- <version>2.3.5</version>-->
|
||||
</dependency>
|
||||
<!-- Ehcache -->
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
<version>2.9.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.73</version>
|
||||
</dependency>
|
||||
<!-- webSocket 发送消息-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.9.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus</artifactId>
|
||||
<version>3.5.3.1</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.baomidou</groupId>-->
|
||||
<!-- <artifactId>mybatis-plus-extension</artifactId>-->
|
||||
<!-- <version>3.3.2</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>autopoi</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>autopoi-web</artifactId>
|
||||
<version>1.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minidev</groupId>
|
||||
<artifactId>json-smart</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>3.5.0</version>
|
||||
</dependency>
|
||||
<!-- Oracle jiang 20230925-->
|
||||
<dependency>
|
||||
<groupId>com.oracle.database.jdbc</groupId>
|
||||
<artifactId>ojdbc8</artifactId>
|
||||
<version>12.2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<compilerArgument>-Xlint:unchecked</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
<!--值为true是指打包时包含scope为system的第三方Jar包-->
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.json</include>
|
||||
<include>**/*.ftl</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,23 @@
|
||||
package org.gyk.common;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/*1,新建异常捕获类
|
||||
*2,类上添加注解@ControllerAdvice
|
||||
*3,在Class里面添加方法
|
||||
*4,方法上添加注解@ExceptionHandler(Exception.class)用来拦截相应的异常信息
|
||||
*5,如果返回的是View,方法返回值是ModelAndView
|
||||
*6,如果返回的是String或者Json数据,则需要加@ResponseBody注解
|
||||
*/
|
||||
@ControllerAdvice
|
||||
public class GlobalDefaultExceptionHandler {
|
||||
@ResponseBody
|
||||
@ExceptionHandler(Exception.class)
|
||||
public String defaultExceptionHandler(HttpServletRequest req,Exception e){
|
||||
System.out.println(e);
|
||||
return "Sorry,Server Error";
|
||||
}
|
||||
}
|
15
src/main/java/org/gyk/common/annotation/AutoLog.java
Normal file
15
src/main/java/org/gyk/common/annotation/AutoLog.java
Normal file
@ -0,0 +1,15 @@
|
||||
package org.gyk.common.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface AutoLog {
|
||||
/**
|
||||
* 日志内容
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String value() default "";
|
||||
}
|
29
src/main/java/org/gyk/common/api/ISysBaseAPI.java
Normal file
29
src/main/java/org/gyk/common/api/ISysBaseAPI.java
Normal file
@ -0,0 +1,29 @@
|
||||
package org.gyk.common.api;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import org.gyk.common.vo.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 底层共通业务API,提供其他独立模块调用
|
||||
* @Author: scott
|
||||
* @Date:2019-4-20
|
||||
* @Version:V1.0
|
||||
*/
|
||||
public interface ISysBaseAPI {
|
||||
|
||||
/**
|
||||
* 获取当前数据库类型
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String getDatabaseType() throws SQLException;
|
||||
|
||||
|
||||
}
|
105
src/main/java/org/gyk/common/api/Result.java
Normal file
105
src/main/java/org/gyk/common/api/Result.java
Normal file
@ -0,0 +1,105 @@
|
||||
package org.gyk.common.api;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.gyk.common.constant.CommonConstant;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@ApiModel(value="接口返回对象", description="接口返回对象")
|
||||
public class Result<T> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
@ApiModelProperty(value = "成功标志")
|
||||
private boolean success = true;
|
||||
|
||||
/**
|
||||
* 返回处理消息
|
||||
*/
|
||||
@ApiModelProperty(value = "返回处理消息")
|
||||
private String message = "操作成功!";
|
||||
|
||||
/**
|
||||
* 返回代码
|
||||
*/
|
||||
@ApiModelProperty(value = "返回代码")
|
||||
private Integer code = 0;
|
||||
|
||||
/**
|
||||
* 返回数据对象 data
|
||||
*/
|
||||
@ApiModelProperty(value = "返回数据对象")
|
||||
private T result;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
@ApiModelProperty(value = "时间戳")
|
||||
private long timestamp = System.currentTimeMillis();
|
||||
|
||||
public Result() {
|
||||
|
||||
}
|
||||
public Result<T> success(String message) {
|
||||
this.message = message;
|
||||
this.code = CommonConstant.SC_OK_200;
|
||||
this.success = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public static Result<Object> ok() {
|
||||
Result<Object> r = new Result<Object>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setMessage("成功");
|
||||
return r;
|
||||
}
|
||||
|
||||
public static Result<Object> ok(String msg) {
|
||||
Result<Object> r = new Result<Object>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setMessage(msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static Result<Object> ok(Object data) {
|
||||
Result<Object> r = new Result<Object>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setResult(data);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static Result<Object> error(String msg) {
|
||||
return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
|
||||
}
|
||||
|
||||
public static Result<Object> error(int code, String msg) {
|
||||
Result<Object> r = new Result<Object>();
|
||||
r.setCode(code);
|
||||
r.setMessage(msg);
|
||||
r.setSuccess(false);
|
||||
return r;
|
||||
}
|
||||
|
||||
public Result<T> error500(String message) {
|
||||
this.message = message;
|
||||
this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
|
||||
this.success = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package org.gyk.common.base.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: Controller基类
|
||||
* @Date: 2021-3-23 8:13
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
public class gykController<T,S extends IService<T>> {
|
||||
@Autowired
|
||||
S service;
|
||||
/**
|
||||
* 获取对象ID
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getId(T item) {
|
||||
try {
|
||||
return PropertyUtils.getProperty(item, "id").toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
46
src/main/java/org/gyk/common/base/entity/gykEntity.java
Normal file
46
src/main/java/org/gyk/common/base/entity/gykEntity.java
Normal file
@ -0,0 +1,46 @@
|
||||
package org.gyk.common.base.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class gykEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private java.lang.String id;
|
||||
/** 创建人 */
|
||||
@ApiModelProperty(value = "创建人")
|
||||
@Excel(name = "创建人", width = 15)
|
||||
private java.lang.String createBy;
|
||||
/** 创建时间 */
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
/** 更新人 */
|
||||
@ApiModelProperty(value = "更新人")
|
||||
@Excel(name = "更新人", width = 15)
|
||||
private java.lang.String updateBy;
|
||||
/** 更新时间 */
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
}
|
30
src/main/java/org/gyk/common/base/mapper/RootMapper.java
Normal file
30
src/main/java/org/gyk/common/base/mapper/RootMapper.java
Normal file
@ -0,0 +1,30 @@
|
||||
package org.gyk.common.base.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 根Mapper,给表Mapper继承用的,可以自定义通用方法
|
||||
* {@link BaseMapper}
|
||||
* {@link com.baomidou.mybatisplus.extension.service.IService}
|
||||
* {@link com.baomidou.mybatisplus.extension.service.impl.ServiceImpl}
|
||||
*/
|
||||
@Mapper
|
||||
public interface RootMapper<T> extends BaseMapper<T> {
|
||||
|
||||
/**
|
||||
* 自定义批量插入
|
||||
* 如果要自动填充,@Param(xx) xx参数名必须是 list/collection/array 3个的其中之一
|
||||
*/
|
||||
int insertBatch(@Param("list") List<T> list);
|
||||
|
||||
/**
|
||||
* 自定义批量新增或更新
|
||||
* 如果要自动填充,@Param(xx) xx参数名必须是 list/collection/array 3个的其中之一
|
||||
*/
|
||||
int mysqlInsertOrUpdateBath(@Param("list") List<T> list);
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package org.gyk.common.base.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface gykService<T> extends IService<T> {
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package org.gyk.common.base.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.gyk.common.base.entity.gykEntity;
|
||||
import org.gyk.common.base.service.gykService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class gykServiceImpl <M extends BaseMapper<T>, T extends gykEntity> extends ServiceImpl<M,T> implements gykService<T> {
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package org.gyk.common.constant;
|
||||
|
||||
public interface CommonConstant {
|
||||
/** {@code 200 OK} (HTTP/1.0 - RFC 1945) */
|
||||
public static final Integer SC_OK_200 = 200;
|
||||
/** {@code 500 Server Error} (HTTP/1.0 - RFC 1945) */
|
||||
public static final Integer SC_INTERNAL_SERVER_ERROR_500 = 500;
|
||||
}
|
151
src/main/java/org/gyk/common/constant/DataBaseConstant.java
Normal file
151
src/main/java/org/gyk/common/constant/DataBaseConstant.java
Normal file
@ -0,0 +1,151 @@
|
||||
package org.gyk.common.constant;
|
||||
/**
|
||||
* 数据库上下文常量
|
||||
*/
|
||||
public interface DataBaseConstant {
|
||||
//*********数据库类型****************************************
|
||||
public static final String DB_TYPE_MYSQL = "MYSQL";
|
||||
public static final String DB_TYPE_ORACLE = "ORACLE";
|
||||
public static final String DB_TYPE_POSTGRESQL = "POSTGRESQL";
|
||||
public static final String DB_TYPE_SQLSERVER = "SQLSERVER";
|
||||
|
||||
// 数据库类型,对应 database_type 字典
|
||||
public static final String DB_TYPE_MYSQL_NUM = "1";
|
||||
public static final String DB_TYPE_ORACLE_NUM = "2";
|
||||
public static final String DB_TYPE_SQLSERVER_NUM = "3";
|
||||
public static final String DB_TYPE_POSTGRESQL_NUM = "4";
|
||||
//*********系统上下文变量****************************************
|
||||
/**
|
||||
* 数据-所属机构编码
|
||||
*/
|
||||
public static final String SYS_ORG_CODE = "sysOrgCode";
|
||||
/**
|
||||
* 数据-所属机构编码
|
||||
*/
|
||||
public static final String SYS_ORG_CODE_TABLE = "sys_org_code";
|
||||
|
||||
/**
|
||||
* 数据-所属机构编码id by 闵
|
||||
*/
|
||||
public static final String SYS_ORG_CODE_ID = "sysOrgCodeId";
|
||||
/**
|
||||
* 数据-所属机构编码 by 闵
|
||||
*/
|
||||
public static final String SYS_ORG_CODE_ID_TABLE = "sys_org_code_id";
|
||||
|
||||
|
||||
/**
|
||||
* 数据-所属机构名称
|
||||
*/
|
||||
public static final String SYS_DEP_NAME = "sysDepName";
|
||||
/**
|
||||
* 数据-所属机构名称
|
||||
*/
|
||||
public static final String SYS_DEP_NAME_TABLE = "sys_dep_name";
|
||||
/**
|
||||
* 数据-所属机构编码
|
||||
*/
|
||||
public static final String SYS_MULTI_ORG_CODE = "sysMultiOrgCode";
|
||||
/**
|
||||
* 数据-所属机构编码
|
||||
*/
|
||||
public static final String SYS_MULTI_ORG_CODE_TABLE = "sys_multi_org_code";
|
||||
|
||||
/**
|
||||
* 数据-所属机构ids by 闵
|
||||
*/
|
||||
public static final String SYS_MULTI_DEP_IDS = "sysMultiDepIds";
|
||||
/**
|
||||
* 数据-所属机构ids by 闵
|
||||
*/
|
||||
public static final String SYS_MULTI_DEP_IDS_TABLE = "sys_multi_dep_ids";
|
||||
|
||||
/**
|
||||
* 数据-系统用户编码(对应登录用户账号)
|
||||
*/
|
||||
public static final String SYS_USER_CODE = "sysUserCode";
|
||||
/**
|
||||
* 数据-系统用户编码(对应登录用户账号)
|
||||
*/
|
||||
public static final String SYS_USER_CODE_TABLE = "sys_user_code";
|
||||
|
||||
/**
|
||||
* 登录用户真实姓名
|
||||
*/
|
||||
public static final String SYS_USER_NAME = "sysUserName";
|
||||
/**
|
||||
* 登录用户真实姓名
|
||||
*/
|
||||
public static final String SYS_USER_NAME_TABLE = "sys_user_name";
|
||||
/**
|
||||
* 登录用户劳动合同号
|
||||
* 测试能否成为系统变量 20220310
|
||||
*/
|
||||
public static final String WORK_NO = "workNo";
|
||||
/**
|
||||
* 登录用户劳动合同号 20220310
|
||||
*/
|
||||
public static final String WORK_NO_TABLE = "work_no";
|
||||
/**
|
||||
* 系统日期"yyyy-MM-dd"
|
||||
*/
|
||||
public static final String SYS_DATE = "sysDate";
|
||||
/**
|
||||
* 系统日期"yyyy-MM-dd"
|
||||
*/
|
||||
public static final String SYS_DATE_TABLE = "sys_date";
|
||||
/**
|
||||
* 系统时间"yyyy-MM-dd HH:mm"
|
||||
*/
|
||||
public static final String SYS_TIME = "sysTime";
|
||||
/**
|
||||
* 系统时间"yyyy-MM-dd HH:mm"
|
||||
*/
|
||||
public static final String SYS_TIME_TABLE = "sys_time";
|
||||
//*********系统上下文变量****************************************
|
||||
|
||||
|
||||
//*********系统建表标准字段****************************************
|
||||
/**
|
||||
* 创建者登录名称
|
||||
*/
|
||||
public static final String CREATE_BY_TABLE = "create_by";
|
||||
/**
|
||||
* 创建者登录名称
|
||||
*/
|
||||
public static final String CREATE_BY = "createBy";
|
||||
/**
|
||||
* 创建日期时间
|
||||
*/
|
||||
public static final String CREATE_TIME_TABLE = "create_time";
|
||||
/**
|
||||
* 创建日期时间
|
||||
*/
|
||||
public static final String CREATE_TIME = "createTime";
|
||||
/**
|
||||
* 更新用户登录名称
|
||||
*/
|
||||
public static final String UPDATE_BY_TABLE = "update_by";
|
||||
/**
|
||||
* 更新用户登录名称
|
||||
*/
|
||||
public static final String UPDATE_BY = "updateBy";
|
||||
/**
|
||||
* 更新日期时间
|
||||
*/
|
||||
public static final String UPDATE_TIME = "updateTime";
|
||||
/**
|
||||
* 更新日期时间
|
||||
*/
|
||||
public static final String UPDATE_TIME_TABLE = "update_time";
|
||||
|
||||
/**
|
||||
* 业务流程状态
|
||||
*/
|
||||
public static final String BPM_STATUS = "bpmStatus";
|
||||
/**
|
||||
* 业务流程状态
|
||||
*/
|
||||
public static final String BPM_STATUS_TABLE = "bpm_status";
|
||||
//*********系统建表标准字段****************************************
|
||||
}
|
787
src/main/java/org/gyk/common/query/QueryGenerator.java
Normal file
787
src/main/java/org/gyk/common/query/QueryGenerator.java
Normal file
@ -0,0 +1,787 @@
|
||||
package org.gyk.common.query;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
import org.gyk.common.util.DataAutorUtils;
|
||||
import org.gyk.common.constant.CommonConstant;
|
||||
import org.gyk.common.constant.DataBaseConstant;
|
||||
import org.gyk.common.api.ISysBaseAPI;
|
||||
import org.gyk.common.vo.SysPermissionDataRuleModel;
|
||||
import org.gyk.common.util.DateUtils;
|
||||
import org.gyk.common.util.SqlInjectionUtil;
|
||||
import org.gyk.common.util.oConvertUtils;
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.springframework.util.NumberUtils;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLDecoder;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class QueryGenerator {
|
||||
public static final String SQL_RULES_COLUMN = "SQL_RULES_COLUMN";
|
||||
|
||||
private static final String BEGIN = "_begin";
|
||||
private static final String END = "_end";
|
||||
/**
|
||||
* 数字类型字段,拼接此后缀 接受多值参数
|
||||
*/
|
||||
private static final String MULTI = "_MultiString";
|
||||
private static final String STAR = "*";
|
||||
private static final String COMMA = ",";
|
||||
private static final String NOT_EQUAL = "!";
|
||||
/**页面带有规则值查询,空格作为分隔符*/
|
||||
private static final String QUERY_SEPARATE_KEYWORD = " ";
|
||||
/** 单引号 */
|
||||
public static final String SQL_SQ = "'";
|
||||
/**排序列*/
|
||||
private static final String ORDER_COLUMN = "column";
|
||||
/**排序方式*/
|
||||
private static final String ORDER_TYPE = "order";
|
||||
private static final String ORDER_TYPE_ASC = "ASC";
|
||||
|
||||
/**时间格式化 */
|
||||
private static final ThreadLocal<SimpleDateFormat> local = new ThreadLocal<SimpleDateFormat>();
|
||||
private static SimpleDateFormat getTime(){
|
||||
SimpleDateFormat time = local.get();
|
||||
if(time == null){
|
||||
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
local.set(time);
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查询条件构造器QueryWrapper实例 通用查询条件已被封装完成
|
||||
* @param searchObj 查询实体
|
||||
* @param parameterMap request.getParameterMap()
|
||||
* @return QueryWrapper实例
|
||||
*/
|
||||
public static <T> QueryWrapper<T> initQueryWrapper(T searchObj,Map<String, String[]> parameterMap){
|
||||
long start = System.currentTimeMillis();
|
||||
QueryWrapper<T> queryWrapper = new QueryWrapper<T>();
|
||||
installMplus(queryWrapper, searchObj, parameterMap,true);
|
||||
log.debug("---查询条件构造器初始化完成,耗时:"+(System.currentTimeMillis()-start)+"毫秒----");
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉新增是否加载 createTime等jeecg自带自带的查询
|
||||
* @Param: [searchObj, parameterMap, ifTime]
|
||||
* @Return: com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<T>
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2024/1/17 16:45
|
||||
*/
|
||||
public static <T> QueryWrapper<T> initQueryWrapper(T searchObj,Map<String, String[]> parameterMap,Boolean ifTime){
|
||||
long start = System.currentTimeMillis();
|
||||
QueryWrapper<T> queryWrapper = new QueryWrapper<T>();
|
||||
installMplus(queryWrapper, searchObj, parameterMap,ifTime);
|
||||
log.debug("---查询条件构造器初始化完成,耗时:"+(System.currentTimeMillis()-start)+"毫秒----");
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装Mybatis Plus 查询条件
|
||||
* <p>使用此方法 需要有如下几点注意:
|
||||
* <br>1.使用QueryWrapper 而非LambdaQueryWrapper;
|
||||
* <br>2.实例化QueryWrapper时不可将实体传入参数
|
||||
* <br>错误示例:如QueryWrapper<JeecgDemo> queryWrapper = new QueryWrapper<JeecgDemo>(jeecgDemo);
|
||||
* <br>正确示例:QueryWrapper<JeecgDemo> queryWrapper = new QueryWrapper<JeecgDemo>();
|
||||
* <br>3.也可以不使用这个方法直接调用 {@link #initQueryWrapper}直接获取实例
|
||||
*/
|
||||
private static void installMplus(QueryWrapper<?> queryWrapper,Object searchObj,Map<String, String[]> parameterMap,Boolean ifTime) {
|
||||
|
||||
/*
|
||||
* 注意:权限查询由前端配置数据规则 当一个人有多个所属部门时候 可以在规则配置包含条件 orgCode 包含 #{sys_org_code}
|
||||
但是不支持在自定义SQL中写orgCode in #{sys_org_code}
|
||||
当一个人只有一个部门 就直接配置等于条件: orgCode 等于 #{sys_org_code} 或者配置自定义SQL: orgCode = '#{sys_org_code}'
|
||||
*/
|
||||
|
||||
//区间条件组装 模糊查询 高级查询组装 简单排序 权限查询
|
||||
PropertyDescriptor[] origDescriptors = PropertyUtils.getPropertyDescriptors(searchObj);
|
||||
Map<String,SysPermissionDataRuleModel> ruleMap = getRuleMap();
|
||||
|
||||
String name, type, column;
|
||||
// update-begin--Author:taoyan Date:20200923 for:issues/1671 如果字段加注解了@TableField(exist = false),不走DB查询-------
|
||||
//定义实体字段和数据库字段名称的映射 高级查询中 只能获取实体字段 如果设置TableField注解 那么查询条件会出问题
|
||||
Map<String,String> fieldColumnMap = new HashMap<>(5);
|
||||
for (int i = 0; i < origDescriptors.length; i++) {
|
||||
//aliasName = origDescriptors[i].getName(); mybatis 不存在实体属性 不用处理别名的情况
|
||||
name = origDescriptors[i].getName();
|
||||
type = origDescriptors[i].getPropertyType().toString();
|
||||
try {
|
||||
if (judgedIsUselessField(name)|| !PropertyUtils.isReadable(searchObj, name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Object value = PropertyUtils.getSimpleProperty(searchObj, name);
|
||||
column = getTableFieldName(searchObj.getClass(), name);
|
||||
if(column==null){
|
||||
//column为null只有一种情况 那就是 添加了注解@TableField(exist = false) 后续都不用处理了
|
||||
continue;
|
||||
}
|
||||
fieldColumnMap.put(name,column);
|
||||
//区间查询
|
||||
doIntervalQuery(queryWrapper, parameterMap, type, name, column);
|
||||
//判断单值 参数带不同标识字符串 走不同的查询
|
||||
//TODO 这种前后带逗号的支持分割后模糊查询(多选字段查询生效) 示例:,1,3,
|
||||
if (null != value && value.toString().startsWith(COMMA) && value.toString().endsWith(COMMA)) {
|
||||
String multiLikeval = value.toString().replace(",,", COMMA);
|
||||
String[] vals = multiLikeval.substring(1, multiLikeval.length()).split(COMMA);
|
||||
final String field = oConvertUtils.camelToUnderline(column);
|
||||
if(vals.length>1) {
|
||||
queryWrapper.and(j -> {
|
||||
log.info("---查询过滤器,Query规则---field:{}, rule:{}, value:{}", field, "like", vals[0]);
|
||||
j = j.like(field,vals[0]);
|
||||
for (int k=1;k<vals.length;k++) {
|
||||
j = j.or().like(field,vals[k]);
|
||||
log.info("---查询过滤器,Query规则 .or()---field:{}, rule:{}, value:{}", field, "like", vals[k]);
|
||||
}
|
||||
//return j;
|
||||
});
|
||||
}else {
|
||||
log.info("---查询过滤器,Query规则---field:{}, rule:{}, value:{}", field, "like", vals[0]);
|
||||
queryWrapper.and(j -> j.like(field,vals[0]));
|
||||
}
|
||||
}else {
|
||||
//根据参数值带什么关键字符串判断走什么类型的查询
|
||||
QueryRuleEnum rule = convert2Rule(value);
|
||||
value = replaceValue(rule,value);
|
||||
addEasyQuery(queryWrapper, column, rule, value);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
// 排序逻辑 处理
|
||||
doMultiFieldsOrder(queryWrapper, parameterMap, fieldColumnMap,ifTime);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表字段名
|
||||
* @param clazz
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
private static String getTableFieldName(Class<?> clazz, String name) {
|
||||
try {
|
||||
//如果字段加注解了@TableField(exist = false),不走DB查询
|
||||
Field field = null;
|
||||
try {
|
||||
field = clazz.getDeclaredField(name);
|
||||
} catch (NoSuchFieldException e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
|
||||
//如果为空,则去父类查找字段
|
||||
if (field == null) {
|
||||
List<Field> allFields = getClassFields(clazz);
|
||||
List<Field> searchFields = allFields.stream().filter(a -> a.getName().equals(name)).collect(Collectors.toList());
|
||||
if(searchFields!=null && searchFields.size()>0){
|
||||
field = searchFields.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (field != null) {
|
||||
TableField tableField = field.getAnnotation(TableField.class);
|
||||
if (tableField != null){
|
||||
if(tableField.exist() == false){
|
||||
//如果设置了TableField false 这个字段不需要处理
|
||||
return null;
|
||||
}else{
|
||||
String column = tableField.value();
|
||||
//如果设置了TableField value 这个字段是实体字段
|
||||
if(!"".equals(column)){
|
||||
return column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取class的 包括父类的
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
private static List<Field> getClassFields(Class<?> clazz) {
|
||||
List<Field> list = new ArrayList<Field>();
|
||||
Field[] fields;
|
||||
do{
|
||||
fields = clazz.getDeclaredFields();
|
||||
for(int i = 0;i<fields.length;i++){
|
||||
list.add(fields[i]);
|
||||
}
|
||||
clazz = clazz.getSuperclass();
|
||||
}while(clazz!= Object.class&&clazz!=null);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 区间查询
|
||||
* @param queryWrapper query对象
|
||||
* @param parameterMap 参数map
|
||||
* @param type 字段类型
|
||||
* @param filedName 字段名称
|
||||
* @param columnName 列名称
|
||||
*/
|
||||
private static void doIntervalQuery(QueryWrapper<?> queryWrapper, Map<String, String[]> parameterMap, String type, String filedName, String columnName) throws ParseException {
|
||||
// 添加 判断是否有区间值
|
||||
String endValue = null,beginValue = null;
|
||||
if (parameterMap != null && parameterMap.containsKey(filedName + BEGIN)) {
|
||||
beginValue = parameterMap.get(filedName + BEGIN)[0].trim();
|
||||
addQueryByRule(queryWrapper, columnName, type, beginValue, QueryRuleEnum.GE);
|
||||
|
||||
}
|
||||
if (parameterMap != null && parameterMap.containsKey(filedName + END)) {
|
||||
endValue = parameterMap.get(filedName + END)[0].trim();
|
||||
addQueryByRule(queryWrapper, columnName, type, endValue, QueryRuleEnum.LE);
|
||||
}
|
||||
//多值查询
|
||||
if (parameterMap != null && parameterMap.containsKey(filedName + MULTI)) {
|
||||
endValue = parameterMap.get(filedName + MULTI)[0].trim();
|
||||
addQueryByRule(queryWrapper, columnName.replace(MULTI,""), type, endValue, QueryRuleEnum.IN);
|
||||
}
|
||||
}
|
||||
//多字段排序
|
||||
private static void doMultiFieldsOrder(QueryWrapper<?> queryWrapper,Map<String, String[]> parameterMap, Map<String,String> fieldColumnMap,Boolean ifTime) {
|
||||
Set<String> allFields = fieldColumnMap.keySet();
|
||||
String column=null,order=null;
|
||||
if(parameterMap!=null&& parameterMap.containsKey(ORDER_COLUMN)) {
|
||||
column = parameterMap.get(ORDER_COLUMN)[0];
|
||||
}
|
||||
if(parameterMap!=null&& parameterMap.containsKey(ORDER_TYPE)) {
|
||||
order = parameterMap.get(ORDER_TYPE)[0];
|
||||
}
|
||||
//排除createTime by 闵
|
||||
if (!ifTime&&"createBy,createTime,updateBy,updateTime,sysOrgCode".contains(column)){
|
||||
return;
|
||||
}
|
||||
log.info("排序规则>>列:" + column + ",排序方式:" + order);
|
||||
|
||||
//update-begin-author:scott date:2022-11-07 for:避免用户自定义表无默认字段{创建时间},导致排序报错
|
||||
//TODO 避免用户自定义表无默认字段创建时间,导致排序报错
|
||||
// if(DataBaseConstant.CREATE_TIME.equals(column) && !fieldColumnMap.containsKey(DataBaseConstant.CREATE_TIME)){
|
||||
// column = "id";
|
||||
// log.warn("检测到实体里没有字段createTime,改成采用ID排序!");
|
||||
// }
|
||||
//update-end-author:scott date:2022-11-07 for:避免用户自定义表无默认字段{创建时间},导致排序报错
|
||||
|
||||
if (oConvertUtils.isNotEmpty(column) && oConvertUtils.isNotEmpty(order)) {
|
||||
|
||||
//判断column是不是当前实体的
|
||||
log.debug("当前字段有:"+ allFields);
|
||||
//多字段排序方法没有读取 MybatisPlus 注解 @TableField 里 value 的值
|
||||
if (column.contains(",")) {
|
||||
List<String> columnList = Arrays.asList(column.split(","));
|
||||
String columnStrNew = columnList.stream().map(c -> fieldColumnMap.get(c)).collect(Collectors.joining(","));
|
||||
if (oConvertUtils.isNotEmpty(columnStrNew)) {
|
||||
column = columnStrNew;
|
||||
}
|
||||
}else{
|
||||
column = fieldColumnMap.get(column);
|
||||
}
|
||||
//SQL注入check
|
||||
SqlInjectionUtil.filterContent(column);
|
||||
|
||||
//update-begin--Author:scott Date:20210531 for:36 多条件排序无效问题修正-------
|
||||
// 排序规则修改
|
||||
// 将现有排序 _ 前端传递排序条件{....,column: 'column1,column2',order: 'desc'} 翻译成sql "column1,column2 desc"
|
||||
// 修改为 _ 前端传递排序条件{....,column: 'column1,column2',order: 'desc'} 翻译成sql "column1 desc,column2 desc"
|
||||
if (order.toUpperCase().indexOf(ORDER_TYPE_ASC)>=0) {
|
||||
//queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
|
||||
String columnStr = oConvertUtils.camelToUnderline(column);
|
||||
String[] columnArray = columnStr.split(",");
|
||||
queryWrapper.orderByAsc(Arrays.asList(columnArray));
|
||||
} else {
|
||||
//queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
|
||||
String columnStr = oConvertUtils.camelToUnderline(column);
|
||||
String[] columnArray = columnStr.split(",");
|
||||
queryWrapper.orderByDesc(Arrays.asList(columnArray));
|
||||
}
|
||||
//update-end--Author:scott Date:20210531 for:36 多条件排序无效问题修正-------
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 根据所传的值 转化成对应的比较方式
|
||||
* 支持><= like in !
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private static QueryRuleEnum convert2Rule(Object value) {
|
||||
// 避免空数据
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
String val = (value + "").toString().trim();
|
||||
if (val.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
QueryRuleEnum rule =null;
|
||||
|
||||
//update-begin--Author:scott Date:20190724 for:initQueryWrapper组装sql查询条件错误 #284-------------------
|
||||
//TODO 此处规则,只适用于 le lt ge gt
|
||||
// step 2 .>= =<
|
||||
if (rule == null && val.length() >= 3) {
|
||||
if(QUERY_SEPARATE_KEYWORD.equals(val.substring(2, 3))){
|
||||
rule = QueryRuleEnum.getByValue(val.substring(0, 2));
|
||||
}
|
||||
}
|
||||
// step 1 .> <
|
||||
if (rule == null && val.length() >= 2) {
|
||||
if(QUERY_SEPARATE_KEYWORD.equals(val.substring(1, 2))){
|
||||
rule = QueryRuleEnum.getByValue(val.substring(0, 1));
|
||||
}
|
||||
}
|
||||
//update-end--Author:scott Date:20190724 for:initQueryWrapper组装sql查询条件错误 #284---------------------
|
||||
|
||||
// step 3 like
|
||||
if (rule == null && val.contains(STAR)) {
|
||||
if (val.startsWith(STAR) && val.endsWith(STAR)) {
|
||||
rule = QueryRuleEnum.LIKE;
|
||||
} else if (val.startsWith(STAR)) {
|
||||
rule = QueryRuleEnum.LEFT_LIKE;
|
||||
} else if(val.endsWith(STAR)){
|
||||
rule = QueryRuleEnum.RIGHT_LIKE;
|
||||
}
|
||||
}
|
||||
// step 4 in
|
||||
if (rule == null && val.contains(COMMA)) {
|
||||
//TODO in 查询这里应该有个bug 如果一字段本身就是多选 此时用in查询 未必能查询出来
|
||||
rule = QueryRuleEnum.IN;
|
||||
}
|
||||
// step 5 !=
|
||||
if(rule == null && val.startsWith(NOT_EQUAL)){
|
||||
rule = QueryRuleEnum.NE;
|
||||
}
|
||||
return rule != null ? rule : QueryRuleEnum.EQ;
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换掉关键字字符
|
||||
*
|
||||
* @param rule
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private static Object replaceValue(QueryRuleEnum rule, Object value) {
|
||||
if (rule == null) {
|
||||
return null;
|
||||
}
|
||||
if (! (value instanceof String)){
|
||||
return value;
|
||||
}
|
||||
String val = (value + "").toString().trim();
|
||||
if (rule == QueryRuleEnum.LIKE) {
|
||||
value = val.substring(1, val.length() - 1);
|
||||
} else if (rule == QueryRuleEnum.LEFT_LIKE || rule == QueryRuleEnum.NE) {
|
||||
value = val.substring(1);
|
||||
} else if (rule == QueryRuleEnum.RIGHT_LIKE) {
|
||||
value = val.substring(0, val.length() - 1);
|
||||
} else if (rule == QueryRuleEnum.IN) {
|
||||
value = val.split(",");
|
||||
} else {
|
||||
//update-begin--Author:scott Date:20190724 for:initQueryWrapper组装sql查询条件错误 #284-------------------
|
||||
if(val.startsWith(rule.getValue())){
|
||||
//TODO 此处逻辑应该注释掉-> 如果查询内容中带有查询匹配规则符号,就会被截取的(比如:>=您好)
|
||||
value = val.replaceFirst(rule.getValue(),"");
|
||||
}else if(val.startsWith(rule.getCondition()+QUERY_SEPARATE_KEYWORD)){
|
||||
value = val.replaceFirst(rule.getCondition()+QUERY_SEPARATE_KEYWORD,"").trim();
|
||||
}
|
||||
//update-end--Author:scott Date:20190724 for:initQueryWrapper组装sql查询条件错误 #284-------------------
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private static void addQueryByRule(QueryWrapper<?> queryWrapper,String name,String type,String value,QueryRuleEnum rule) throws ParseException {
|
||||
if(oConvertUtils.isNotEmpty(value)) {
|
||||
Object temp;
|
||||
// 针对数字类型字段,多值查询
|
||||
if(value.indexOf(COMMA)!=-1){
|
||||
temp = value;
|
||||
addEasyQuery(queryWrapper, name, rule, temp);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case "class java.lang.Integer":
|
||||
temp = Integer.parseInt(value);
|
||||
break;
|
||||
case "class java.math.BigDecimal":
|
||||
temp = new BigDecimal(value);
|
||||
break;
|
||||
case "class java.lang.Short":
|
||||
temp = Short.parseShort(value);
|
||||
break;
|
||||
case "class java.lang.Long":
|
||||
temp = Long.parseLong(value);
|
||||
break;
|
||||
case "class java.lang.Float":
|
||||
temp = Float.parseFloat(value);
|
||||
break;
|
||||
case "class java.lang.Double":
|
||||
temp = Double.parseDouble(value);
|
||||
break;
|
||||
case "class java.util.Date":
|
||||
temp = getDateQueryByRule(value, rule);
|
||||
break;
|
||||
default:
|
||||
temp = value;
|
||||
break;
|
||||
}
|
||||
addEasyQuery(queryWrapper, name, rule, temp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取日期类型的值
|
||||
* @param value
|
||||
* @param rule
|
||||
* @return
|
||||
* @throws ParseException
|
||||
*/
|
||||
private static Date getDateQueryByRule(String value,QueryRuleEnum rule) throws ParseException {
|
||||
Date date = null;
|
||||
if(value.length()==10) {
|
||||
if(rule==QueryRuleEnum.GE) {
|
||||
//比较大于
|
||||
date = getTime().parse(value + " 00:00:00");
|
||||
}else if(rule==QueryRuleEnum.LE) {
|
||||
//比较小于
|
||||
date = getTime().parse(value + " 23:59:59");
|
||||
}
|
||||
//TODO 日期类型比较特殊 可能oracle下不一定好使
|
||||
}
|
||||
if(date==null) {
|
||||
date = getTime().parse(value);
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据规则走不同的查询
|
||||
* @param queryWrapper QueryWrapper
|
||||
* @param name 字段名字
|
||||
* @param rule 查询规则
|
||||
* @param value 查询条件值
|
||||
*/
|
||||
private static void addEasyQuery(QueryWrapper<?> queryWrapper, String name, QueryRuleEnum rule, Object value) {
|
||||
if (value == null || rule == null || oConvertUtils.isEmpty(value)) {
|
||||
return;
|
||||
}
|
||||
name = oConvertUtils.camelToUnderline(name);
|
||||
log.info("--查询规则-->"+name+" "+rule.getValue()+" "+value);
|
||||
switch (rule) {
|
||||
case GT:
|
||||
queryWrapper.gt(name, value);
|
||||
break;
|
||||
case GE:
|
||||
queryWrapper.ge(name, value);
|
||||
break;
|
||||
case LT:
|
||||
queryWrapper.lt(name, value);
|
||||
break;
|
||||
case LE:
|
||||
queryWrapper.le(name, value);
|
||||
break;
|
||||
case EQ:
|
||||
queryWrapper.eq(name, value);
|
||||
break;
|
||||
case NE:
|
||||
queryWrapper.ne(name, value);
|
||||
break;
|
||||
case IN:
|
||||
if(value instanceof String) {
|
||||
queryWrapper.in(name, (Object[])value.toString().split(","));
|
||||
}else if(value instanceof String[]) {
|
||||
queryWrapper.in(name, (Object[]) value);
|
||||
}else {
|
||||
queryWrapper.in(name, value);
|
||||
}
|
||||
break;
|
||||
case LIKE:
|
||||
queryWrapper.like(name, value);
|
||||
break;
|
||||
case LEFT_LIKE:
|
||||
queryWrapper.likeLeft(name, value);
|
||||
break;
|
||||
case RIGHT_LIKE:
|
||||
queryWrapper.likeRight(name, value);
|
||||
break;
|
||||
default:
|
||||
log.info("--查询规则未匹配到---");
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
private static boolean judgedIsUselessField(String name) {
|
||||
return "class".equals(name) || "ids".equals(name)
|
||||
|| "page".equals(name) || "rows".equals(name)
|
||||
|| "sort".equals(name) || "order".equals(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @author: scott
|
||||
* @Description: 去掉值前后单引号
|
||||
* @date: 2020/3/19 21:26
|
||||
* @param ruleValue:
|
||||
* @Return: java.lang.String
|
||||
*/
|
||||
public static String trimSingleQuote(String ruleValue) {
|
||||
if (oConvertUtils.isEmpty(ruleValue)) {
|
||||
return "";
|
||||
}
|
||||
if (ruleValue.startsWith(QueryGenerator.SQL_SQ)) {
|
||||
ruleValue = ruleValue.substring(1);
|
||||
}
|
||||
if (ruleValue.endsWith(QueryGenerator.SQL_SQ)) {
|
||||
ruleValue = ruleValue.substring(0, ruleValue.length() - 1);
|
||||
}
|
||||
return ruleValue;
|
||||
}
|
||||
|
||||
// public static String getSqlRuleValue(String sqlRule){
|
||||
// try {
|
||||
// Set<String> varParams = getSqlRuleParams(sqlRule);
|
||||
// for(String var:varParams){
|
||||
// String tempValue = converRuleValue(var);
|
||||
// sqlRule = sqlRule.replace("#{"+var+"}",tempValue);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
// }
|
||||
// return sqlRule;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取sql中的#{key} 这个key组成的set
|
||||
*/
|
||||
public static Set<String> getSqlRuleParams(String sql) {
|
||||
if(oConvertUtils.isEmpty(sql)){
|
||||
return null;
|
||||
}
|
||||
Set<String> varParams = new HashSet<String>();
|
||||
String regex = "\\#\\{\\w+\\}";
|
||||
|
||||
Pattern p = Pattern.compile(regex);
|
||||
Matcher m = p.matcher(sql);
|
||||
while(m.find()){
|
||||
String var = m.group();
|
||||
varParams.add(var.substring(var.indexOf("{")+1,var.indexOf("}")));
|
||||
}
|
||||
return varParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
* @param field
|
||||
* @param alias
|
||||
* @param value
|
||||
* @param isString
|
||||
* @return
|
||||
*/
|
||||
public static String getSingleQueryConditionSql(String field,String alias,Object value,boolean isString) {
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
field = alias+oConvertUtils.camelToUnderline(field);
|
||||
QueryRuleEnum rule = QueryGenerator.convert2Rule(value);
|
||||
return getSingleSqlByRule(rule, field, value, isString);
|
||||
}
|
||||
|
||||
public static String getSingleSqlByRule(QueryRuleEnum rule,String field,Object value,boolean isString) {
|
||||
String res = "";
|
||||
switch (rule) {
|
||||
case GT:
|
||||
res =field+rule.getValue()+getFieldConditionValue(value, isString);
|
||||
break;
|
||||
case GE:
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString);
|
||||
break;
|
||||
case LT:
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString);
|
||||
break;
|
||||
case LE:
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString);
|
||||
break;
|
||||
case EQ:
|
||||
res = field+rule.getValue()+getFieldConditionValue(value, isString);
|
||||
break;
|
||||
case NE:
|
||||
res = field+" <> "+getFieldConditionValue(value, isString);
|
||||
break;
|
||||
case IN:
|
||||
res = field + " in "+getInConditionValue(value, isString);
|
||||
break;
|
||||
case LIKE:
|
||||
res = field + " like "+getLikeConditionValue(value);
|
||||
break;
|
||||
case LEFT_LIKE:
|
||||
res = field + " like "+getLikeConditionValue(value);
|
||||
break;
|
||||
case RIGHT_LIKE:
|
||||
res = field + " like "+getLikeConditionValue(value);
|
||||
break;
|
||||
default:
|
||||
res = field+" = "+getFieldConditionValue(value, isString);
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
private static String getFieldConditionValue(Object value,boolean isString) {
|
||||
String str = value.toString().trim();
|
||||
if(str.startsWith("!")) {
|
||||
str = str.substring(1);
|
||||
}else if(str.startsWith(">=")) {
|
||||
str = str.substring(2);
|
||||
}else if(str.startsWith("<=")) {
|
||||
str = str.substring(2);
|
||||
}else if(str.startsWith(">")) {
|
||||
str = str.substring(1);
|
||||
}else if(str.startsWith("<")) {
|
||||
str = str.substring(1);
|
||||
}
|
||||
if(isString) {
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
|
||||
return " N'"+str+"' ";
|
||||
}else{
|
||||
return " '"+str+"' ";
|
||||
}
|
||||
}else {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private static String getInConditionValue(Object value,boolean isString) {
|
||||
if(isString) {
|
||||
String temp[] = value.toString().split(",");
|
||||
String res="";
|
||||
for (String string : temp) {
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
|
||||
res+=",N'"+string+"'";
|
||||
}else{
|
||||
res+=",'"+string+"'";
|
||||
}
|
||||
}
|
||||
return "("+res.substring(1)+")";
|
||||
}else {
|
||||
return "("+value.toString()+")";
|
||||
}
|
||||
}
|
||||
|
||||
private static String getLikeConditionValue(Object value) {
|
||||
String str = value.toString().trim();
|
||||
if(str.startsWith("*") && str.endsWith("*")) {
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
|
||||
return "N'%"+str.substring(1,str.length()-1)+"%'";
|
||||
}else{
|
||||
return "'%"+str.substring(1,str.length()-1)+"%'";
|
||||
}
|
||||
}else if(str.startsWith("*")) {
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
|
||||
return "N'%"+str.substring(1)+"'";
|
||||
}else{
|
||||
return "'%"+str.substring(1)+"'";
|
||||
}
|
||||
}else if(str.endsWith("*")) {
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
|
||||
return "N'"+str.substring(0,str.length()-1)+"%'";
|
||||
}else{
|
||||
return "'"+str.substring(0,str.length()-1)+"%'";
|
||||
}
|
||||
}else {
|
||||
if(str.indexOf("%")>=0) {
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
|
||||
if(str.startsWith("'") && str.endsWith("'")){
|
||||
return "N"+str;
|
||||
}else{
|
||||
return "N"+"'"+str+"'";
|
||||
}
|
||||
}else{
|
||||
if(str.startsWith("'") && str.endsWith("'")){
|
||||
return str;
|
||||
}else{
|
||||
return "'"+str+"'";
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if(DataBaseConstant.DB_TYPE_SQLSERVER.equals(getDbType())){
|
||||
return "N'%"+str+"%'";
|
||||
}else{
|
||||
return "'%"+str+"%'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求对应的数据权限规则
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, SysPermissionDataRuleModel> getRuleMap() {
|
||||
Map<String, SysPermissionDataRuleModel> ruleMap = new HashMap<String, SysPermissionDataRuleModel>();
|
||||
List<SysPermissionDataRuleModel> list = DataAutorUtils.loadDataSearchConditon();
|
||||
if(list != null&&list.size()>0){
|
||||
if(list.get(0)==null){
|
||||
return ruleMap;
|
||||
}
|
||||
for (SysPermissionDataRuleModel rule : list) {
|
||||
String column = rule.getRuleColumn();
|
||||
if(QueryRuleEnum.SQL_RULES.getValue().equals(rule.getRuleConditions())) {
|
||||
column = SQL_RULES_COLUMN+rule.getId();
|
||||
}
|
||||
ruleMap.put(column, rule);
|
||||
}
|
||||
}
|
||||
return ruleMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换sql中的系统变量
|
||||
* @param sql
|
||||
* @return
|
||||
*/
|
||||
// public static String convertSystemVariables(String sql){
|
||||
// return getSqlRuleValue(sql);
|
||||
// }
|
||||
/** 当前系统数据库类型 */
|
||||
private static String DB_TYPE;
|
||||
/**
|
||||
* 获取系统数据库类型
|
||||
*/
|
||||
private static String getDbType(){
|
||||
if(oConvertUtils.isNotEmpty(DB_TYPE)){
|
||||
return DB_TYPE;
|
||||
}
|
||||
try {
|
||||
ISysBaseAPI sysBaseAPI = ApplicationContextUtil.getContext().getBean(ISysBaseAPI.class);
|
||||
DB_TYPE = sysBaseAPI.getDatabaseType();
|
||||
return DB_TYPE;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return DB_TYPE;
|
||||
}
|
||||
|
||||
}
|
71
src/main/java/org/gyk/common/query/QueryRuleEnum.java
Normal file
71
src/main/java/org/gyk/common/query/QueryRuleEnum.java
Normal file
@ -0,0 +1,71 @@
|
||||
package org.gyk.common.query;
|
||||
|
||||
import org.gyk.common.util.oConvertUtils;
|
||||
|
||||
/**
|
||||
* Query 规则 常量
|
||||
* @Author Scott
|
||||
* @Date 2019年02月14日
|
||||
*/
|
||||
public enum QueryRuleEnum {
|
||||
|
||||
GT(">","gt","大于"),
|
||||
GE(">=","ge","大于等于"),
|
||||
LT("<","lt","小于"),
|
||||
LE("<=","le","小于等于"),
|
||||
EQ("=","eq","等于"),
|
||||
NE("!=","ne","不等于"),
|
||||
IN("IN","in","包含"),
|
||||
LIKE("LIKE","like","全模糊"),
|
||||
LEFT_LIKE("LEFT_LIKE","left_like","左模糊"),
|
||||
RIGHT_LIKE("RIGHT_LIKE","right_like","右模糊"),
|
||||
SQL_RULES("USE_SQL_RULES","ext","自定义SQL片段");
|
||||
|
||||
private String value;
|
||||
|
||||
private String condition;
|
||||
|
||||
private String msg;
|
||||
|
||||
QueryRuleEnum(String value, String condition, String msg){
|
||||
this.value = value;
|
||||
this.condition = condition;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public void setCondition(String condition) {
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
public static QueryRuleEnum getByValue(String value){
|
||||
if(oConvertUtils.isEmpty(value)) {
|
||||
return null;
|
||||
}
|
||||
for(QueryRuleEnum val :values()){
|
||||
if (val.getValue().equals(value) || val.getCondition().equals(value)){
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
77
src/main/java/org/gyk/common/util/DataAutorUtils.java
Normal file
77
src/main/java/org/gyk/common/util/DataAutorUtils.java
Normal file
@ -0,0 +1,77 @@
|
||||
package org.gyk.common.util;
|
||||
|
||||
import org.gyk.common.vo.SysPermissionDataRuleModel;
|
||||
import org.gyk.common.util.SpringContextUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: JeecgDataAutorUtils
|
||||
* @Description: 数据权限查询规则容器工具类
|
||||
* @Author: 张代浩
|
||||
* @Date: 2012-12-15 下午11:27:39
|
||||
*
|
||||
*/
|
||||
public class DataAutorUtils {
|
||||
|
||||
public static final String MENU_DATA_AUTHOR_RULES = "MENU_DATA_AUTHOR_RULES";
|
||||
|
||||
public static final String MENU_DATA_AUTHOR_RULE_SQL = "MENU_DATA_AUTHOR_RULE_SQL";
|
||||
|
||||
public static final String SYS_USER_INFO = "SYS_USER_INFO";
|
||||
|
||||
/**
|
||||
* 往链接请求里面,传入数据查询条件
|
||||
*
|
||||
* @param request
|
||||
* @param dataRules
|
||||
*/
|
||||
public static synchronized void installDataSearchConditon(HttpServletRequest request, List<SysPermissionDataRuleModel> dataRules) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<SysPermissionDataRuleModel> list = (List<SysPermissionDataRuleModel>)loadDataSearchConditon();// 1.先从request获取MENU_DATA_AUTHOR_RULES,如果存则获取到LIST
|
||||
if (list==null) {
|
||||
// 2.如果不存在,则new一个list
|
||||
list = new ArrayList<SysPermissionDataRuleModel>();
|
||||
}
|
||||
for (SysPermissionDataRuleModel tsDataRule : dataRules) {
|
||||
list.add(tsDataRule);
|
||||
}
|
||||
request.setAttribute(MENU_DATA_AUTHOR_RULES, list); // 3.往list里面增量存指
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求对应的数据权限规则
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static synchronized List<SysPermissionDataRuleModel> loadDataSearchConditon() {
|
||||
return (List<SysPermissionDataRuleModel>) SpringContextUtils.getHttpServletRequest().getAttribute(MENU_DATA_AUTHOR_RULES);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求对应的数据权限SQL
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static synchronized String loadDataSearchConditonSQLString() {
|
||||
return (String) SpringContextUtils.getHttpServletRequest().getAttribute(MENU_DATA_AUTHOR_RULE_SQL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 往链接请求里面,传入数据查询条件
|
||||
*
|
||||
* @param request
|
||||
* @param sql
|
||||
*/
|
||||
public static synchronized void installDataSearchConditon(HttpServletRequest request, String sql) {
|
||||
String ruleSql = (String)loadDataSearchConditonSQLString();
|
||||
if (!StringUtils.hasText(ruleSql)) {
|
||||
request.setAttribute(MENU_DATA_AUTHOR_RULE_SQL,sql);
|
||||
}
|
||||
}
|
||||
}
|
700
src/main/java/org/gyk/common/util/DateUtils.java
Normal file
700
src/main/java/org/gyk/common/util/DateUtils.java
Normal file
@ -0,0 +1,700 @@
|
||||
package org.gyk.common.util;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* 类描述:时间操作定义类
|
||||
*
|
||||
* @Author: 张代浩
|
||||
* @Date:2012-12-8 12:15:03
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class DateUtils extends PropertyEditorSupport {
|
||||
|
||||
public static ThreadLocal<SimpleDateFormat> date_sdf = new ThreadLocal<SimpleDateFormat>() {
|
||||
@Override
|
||||
protected SimpleDateFormat initialValue() {
|
||||
return new SimpleDateFormat("yyyy-MM-dd");
|
||||
}
|
||||
};
|
||||
public static ThreadLocal<SimpleDateFormat> yyyyMMdd = new ThreadLocal<SimpleDateFormat>() {
|
||||
@Override
|
||||
protected SimpleDateFormat initialValue() {
|
||||
return new SimpleDateFormat("yyyyMMdd");
|
||||
}
|
||||
};
|
||||
public static ThreadLocal<SimpleDateFormat> date_sdf_wz = new ThreadLocal<SimpleDateFormat>() {
|
||||
@Override
|
||||
protected SimpleDateFormat initialValue() {
|
||||
return new SimpleDateFormat("yyyy年MM月dd日");
|
||||
}
|
||||
};
|
||||
public static ThreadLocal<SimpleDateFormat> time_sdf = new ThreadLocal<SimpleDateFormat>() {
|
||||
@Override
|
||||
protected SimpleDateFormat initialValue() {
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
}
|
||||
};
|
||||
public static ThreadLocal<SimpleDateFormat> yyyymmddhhmmss = new ThreadLocal<SimpleDateFormat>() {
|
||||
@Override
|
||||
protected SimpleDateFormat initialValue() {
|
||||
return new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
}
|
||||
};
|
||||
public static ThreadLocal<SimpleDateFormat> short_time_sdf = new ThreadLocal<SimpleDateFormat>() {
|
||||
@Override
|
||||
protected SimpleDateFormat initialValue() {
|
||||
return new SimpleDateFormat("HH:mm");
|
||||
}
|
||||
};
|
||||
public static ThreadLocal<SimpleDateFormat> datetimeFormat = new ThreadLocal<SimpleDateFormat>() {
|
||||
@Override
|
||||
protected SimpleDateFormat initialValue() {
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
};
|
||||
|
||||
// 以毫秒表示的时间
|
||||
private static final long DAY_IN_MILLIS = 24 * 3600 * 1000;
|
||||
private static final long HOUR_IN_MILLIS = 3600 * 1000;
|
||||
private static final long MINUTE_IN_MILLIS = 60 * 1000;
|
||||
private static final long SECOND_IN_MILLIS = 1000;
|
||||
|
||||
// 指定模式的时间格式
|
||||
private static SimpleDateFormat getSDFormat(String pattern) {
|
||||
return new SimpleDateFormat(pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前日历,这里用中国时间表示
|
||||
*
|
||||
* @return 以当地时区表示的系统当前日历
|
||||
*/
|
||||
public static Calendar getCalendar() {
|
||||
return Calendar.getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定毫秒数表示的日历
|
||||
*
|
||||
* @param millis 毫秒数
|
||||
* @return 指定毫秒数表示的日历
|
||||
*/
|
||||
public static Calendar getCalendar(long millis) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
// --------------------cal.setTimeInMillis(millis);
|
||||
cal.setTime(new Date(millis));
|
||||
return cal;
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// getDate
|
||||
// 各种方式获取的Date
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 当前日期
|
||||
*
|
||||
* @return 系统当前时间
|
||||
*/
|
||||
public static Date getDate() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定毫秒数表示的日期
|
||||
*
|
||||
* @param millis 毫秒数
|
||||
* @return 指定毫秒数表示的日期
|
||||
*/
|
||||
public static Date getDate(long millis) {
|
||||
return new Date(millis);
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间戳转换为字符串
|
||||
*
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
public static String timestamptoStr(Timestamp time) {
|
||||
Date date = null;
|
||||
if (null != time) {
|
||||
date = new Date(time.getTime());
|
||||
}
|
||||
return date2Str(date_sdf.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转换时间戳
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static Timestamp str2Timestamp(String str) {
|
||||
Date date = str2Date(str, date_sdf.get());
|
||||
return new Timestamp(date.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转换成日期
|
||||
*
|
||||
* @param str
|
||||
* @param sdf
|
||||
* @return
|
||||
*/
|
||||
public static Date str2Date(String str, SimpleDateFormat sdf) {
|
||||
if (null == str || "".equals(str)) {
|
||||
return null;
|
||||
}
|
||||
Date date = null;
|
||||
try {
|
||||
date = sdf.parse(str);
|
||||
return date;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期转换为字符串
|
||||
*
|
||||
* @param date_sdf 日期格式
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String date2Str(SimpleDateFormat date_sdf) {
|
||||
Date date = getDate();
|
||||
if (null == date) {
|
||||
return null;
|
||||
}
|
||||
return date_sdf.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化时间
|
||||
*
|
||||
* @param date
|
||||
* @param format
|
||||
* @return
|
||||
*/
|
||||
public static String dateformat(String date, String format) {
|
||||
SimpleDateFormat sformat = new SimpleDateFormat(format);
|
||||
Date _date = null;
|
||||
try {
|
||||
_date = sformat.parse(date);
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return sformat.format(_date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期转换为字符串
|
||||
*
|
||||
* @param date 日期
|
||||
* @param date_sdf 日期格式
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String date2Str(Date date, SimpleDateFormat date_sdf) {
|
||||
if (null == date) {
|
||||
return null;
|
||||
}
|
||||
return date_sdf.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期转换为字符串
|
||||
*
|
||||
* @param format 日期格式
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String getDate(String format) {
|
||||
Date date = new Date();
|
||||
if (null == date) {
|
||||
return null;
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期转换为字符串
|
||||
*
|
||||
* @param format 日期格式
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String setDate(String dateStr,String format) {
|
||||
try {
|
||||
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date parse = sdfDate.parse(dateStr);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
||||
return sdf.format(parse);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 指定毫秒数的时间戳
|
||||
*
|
||||
* @param millis 毫秒数
|
||||
* @return 指定毫秒数的时间戳
|
||||
*/
|
||||
public static Timestamp getTimestamp(long millis) {
|
||||
return new Timestamp(millis);
|
||||
}
|
||||
|
||||
/**
|
||||
* 以字符形式表示的时间戳
|
||||
*
|
||||
* @param time 毫秒数
|
||||
* @return 以字符形式表示的时间戳
|
||||
*/
|
||||
public static Timestamp getTimestamp(String time) {
|
||||
return new Timestamp(Long.parseLong(time));
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统当前的时间戳
|
||||
*
|
||||
* @return 系统当前的时间戳
|
||||
*/
|
||||
public static Timestamp getTimestamp() {
|
||||
return new Timestamp(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前时间,格式 yyyy-MM-dd HH:mm:ss
|
||||
*
|
||||
* @return 当前时间的标准形式字符串
|
||||
*/
|
||||
public static String now() {
|
||||
return datetimeFormat.get().format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的时间戳
|
||||
*
|
||||
* @param date 指定日期
|
||||
* @return 指定日期的时间戳
|
||||
*/
|
||||
public static Timestamp getTimestamp(Date date) {
|
||||
return new Timestamp(date.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日历的时间戳
|
||||
*
|
||||
* @param cal 指定日历
|
||||
* @return 指定日历的时间戳
|
||||
*/
|
||||
public static Timestamp getCalendarTimestamp(Calendar cal) {
|
||||
// ---------------------return new Timestamp(cal.getTimeInMillis());
|
||||
return new Timestamp(cal.getTime().getTime());
|
||||
}
|
||||
|
||||
public static Timestamp gettimestamp() {
|
||||
Date dt = new Date();
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String nowTime = df.format(dt);
|
||||
Timestamp buydate = Timestamp.valueOf(nowTime);
|
||||
return buydate;
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// getMillis
|
||||
// 各种方式获取的Millis
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 系统时间的毫秒数
|
||||
*
|
||||
* @return 系统时间的毫秒数
|
||||
*/
|
||||
public static long getMillis() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日历的毫秒数
|
||||
*
|
||||
* @param cal 指定日历
|
||||
* @return 指定日历的毫秒数
|
||||
*/
|
||||
public static long getMillis(Calendar cal) {
|
||||
// --------------------return cal.getTimeInMillis();
|
||||
return cal.getTime().getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的毫秒数
|
||||
*
|
||||
* @param date 指定日期
|
||||
* @return 指定日期的毫秒数
|
||||
*/
|
||||
public static long getMillis(Date date) {
|
||||
return date.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定时间戳的毫秒数
|
||||
*
|
||||
* @param ts 指定时间戳
|
||||
* @return 指定时间戳的毫秒数
|
||||
*/
|
||||
public static long getMillis(Timestamp ts) {
|
||||
return ts.getTime();
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// formatDate
|
||||
// 将日期按照一定的格式转化为字符串
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 默认方式表示的系统当前日期,具体格式:年-月-日
|
||||
*
|
||||
* @return 默认日期按“年-月-日“格式显示
|
||||
*/
|
||||
public static String formatDate() {
|
||||
return date_sdf.get().format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认方式表示的系统当前日期,具体格式:yyyy-MM-dd HH:mm:ss
|
||||
*
|
||||
* @return 默认日期按“yyyy-MM-dd HH:mm:ss“格式显示
|
||||
*/
|
||||
public static String formatDateTime() {
|
||||
return datetimeFormat.get().format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉
|
||||
* @Param: []
|
||||
* @Return: java.lang.String
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/9/1 10:59
|
||||
*/
|
||||
public static String formatDateTimeSecond(Date date) {
|
||||
return datetimeFormat.get().format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取时间字符串
|
||||
*/
|
||||
public static String getDataString(SimpleDateFormat formatstr) {
|
||||
return formatstr.format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:年-月-日
|
||||
*
|
||||
* @param cal 指定的日期
|
||||
* @return 指定日期按“年-月-日“格式显示
|
||||
*/
|
||||
public static String formatDate(Calendar cal) {
|
||||
return date_sdf.get().format(cal.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:年-月-日
|
||||
*
|
||||
* @param date 指定的日期
|
||||
* @return 指定日期按“年-月-日“格式显示
|
||||
*/
|
||||
public static String formatDate(Date date) {
|
||||
return date_sdf.get().format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定毫秒数表示日期的默认显示,具体格式:年-月-日
|
||||
*
|
||||
* @param millis 指定的毫秒数
|
||||
* @return 指定毫秒数表示日期按“年-月-日“格式显示
|
||||
*/
|
||||
public static String formatDate(long millis) {
|
||||
return date_sdf.get().format(new Date(millis));
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认日期按指定格式显示
|
||||
*
|
||||
* @param pattern 指定的格式
|
||||
* @return 默认日期按指定格式显示
|
||||
*/
|
||||
public static String formatDate(String pattern) {
|
||||
return getSDFormat(pattern).format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期按指定格式显示
|
||||
*
|
||||
* @param cal 指定的日期
|
||||
* @param pattern 指定的格式
|
||||
* @return 指定日期按指定格式显示
|
||||
*/
|
||||
public static String formatDate(Calendar cal, String pattern) {
|
||||
return getSDFormat(pattern).format(cal.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期按指定格式显示
|
||||
*
|
||||
* @param date 指定的日期
|
||||
* @param pattern 指定的格式
|
||||
* @return 指定日期按指定格式显示
|
||||
*/
|
||||
public static String formatDate(Date date, String pattern) {
|
||||
return getSDFormat(pattern).format(date);
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// formatTime
|
||||
// 将日期按照一定的格式转化为字符串
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 默认方式表示的系统当前日期,具体格式:年-月-日 时:分
|
||||
*
|
||||
* @return 默认日期按“年-月-日 时:分“格式显示
|
||||
*/
|
||||
public static String formatTime() {
|
||||
return time_sdf.get().format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定毫秒数表示日期的默认显示,具体格式:年-月-日 时:分
|
||||
*
|
||||
* @param millis 指定的毫秒数
|
||||
* @return 指定毫秒数表示日期按“年-月-日 时:分“格式显示
|
||||
*/
|
||||
public static String formatTime(long millis) {
|
||||
return time_sdf.get().format(new Date(millis));
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:年-月-日 时:分
|
||||
*
|
||||
* @param cal 指定的日期
|
||||
* @return 指定日期按“年-月-日 时:分“格式显示
|
||||
*/
|
||||
public static String formatTime(Calendar cal) {
|
||||
return time_sdf.get().format(cal.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:年-月-日 时:分
|
||||
*
|
||||
* @param date 指定的日期
|
||||
* @return 指定日期按“年-月-日 时:分“格式显示
|
||||
*/
|
||||
public static String formatTime(Date date) {
|
||||
return time_sdf.get().format(date);
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// formatShortTime
|
||||
// 将日期按照一定的格式转化为字符串
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 默认方式表示的系统当前日期,具体格式:时:分
|
||||
*
|
||||
* @return 默认日期按“时:分“格式显示
|
||||
*/
|
||||
public static String formatShortTime() {
|
||||
return short_time_sdf.get().format(getCalendar().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定毫秒数表示日期的默认显示,具体格式:时:分
|
||||
*
|
||||
* @param millis 指定的毫秒数
|
||||
* @return 指定毫秒数表示日期按“时:分“格式显示
|
||||
*/
|
||||
public static String formatShortTime(long millis) {
|
||||
return short_time_sdf.get().format(new Date(millis));
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:时:分
|
||||
*
|
||||
* @param cal 指定的日期
|
||||
* @return 指定日期按“时:分“格式显示
|
||||
*/
|
||||
public static String formatShortTime(Calendar cal) {
|
||||
return short_time_sdf.get().format(cal.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期的默认显示,具体格式:时:分
|
||||
*
|
||||
* @param date 指定的日期
|
||||
* @return 指定日期按“时:分“格式显示
|
||||
*/
|
||||
public static String formatShortTime(Date date) {
|
||||
return short_time_sdf.get().format(date);
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// parseDate
|
||||
// parseCalendar
|
||||
// parseTimestamp
|
||||
// 将字符串按照一定的格式转化为日期或时间
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间
|
||||
*
|
||||
* @param src 将要转换的原始字符窜
|
||||
* @param pattern 转换的匹配格式
|
||||
* @return 如果转换成功则返回转换后的日期
|
||||
* @throws ParseException
|
||||
*/
|
||||
public static Date parseDate(String src, String pattern) throws ParseException {
|
||||
return getSDFormat(pattern).parse(src);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间
|
||||
*
|
||||
* @param src 将要转换的原始字符窜
|
||||
* @param pattern 转换的匹配格式
|
||||
* @return 如果转换成功则返回转换后的日期
|
||||
* @throws ParseException
|
||||
*/
|
||||
public static Calendar parseCalendar(String src, String pattern) throws ParseException {
|
||||
|
||||
Date date = parseDate(src, pattern);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
return cal;
|
||||
}
|
||||
|
||||
public static String formatAddDate(String src, String pattern, int amount) throws ParseException {
|
||||
Calendar cal;
|
||||
cal = parseCalendar(src, pattern);
|
||||
cal.add(Calendar.DATE, amount);
|
||||
return formatDate(cal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间
|
||||
*
|
||||
* @param src 将要转换的原始字符窜
|
||||
* @param pattern 转换的匹配格式
|
||||
* @return 如果转换成功则返回转换后的时间戳
|
||||
* @throws ParseException
|
||||
*/
|
||||
public static Timestamp parseTimestamp(String src, String pattern) throws ParseException {
|
||||
Date date = parseDate(src, pattern);
|
||||
return new Timestamp(date.getTime());
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// dateDiff
|
||||
// 计算两个日期之间的差值
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 计算两个时间之间的差值,根据标志的不同而不同
|
||||
*
|
||||
* @param flag 计算标志,表示按照年/月/日/时/分/秒等计算
|
||||
* @param calSrc 减数
|
||||
* @param calDes 被减数
|
||||
* @return 两个日期之间的差值
|
||||
*/
|
||||
public static int dateDiff(char flag, Calendar calSrc, Calendar calDes) {
|
||||
|
||||
long millisDiff = getMillis(calSrc) - getMillis(calDes);
|
||||
|
||||
if (flag == 'y') {
|
||||
return (calSrc.get(Calendar.YEAR) - calDes.get(Calendar.YEAR));
|
||||
}
|
||||
|
||||
if (flag == 'd') {
|
||||
return (int) (millisDiff / DAY_IN_MILLIS);
|
||||
}
|
||||
|
||||
if (flag == 'h') {
|
||||
return (int) (millisDiff / HOUR_IN_MILLIS);
|
||||
}
|
||||
|
||||
if (flag == 'm') {
|
||||
return (int) (millisDiff / MINUTE_IN_MILLIS);
|
||||
}
|
||||
|
||||
if (flag == 's') {
|
||||
return (int) (millisDiff / SECOND_IN_MILLIS);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* String类型 转换为Date, 如果参数长度为10 转换格式”yyyy-MM-dd“ 如果参数长度为19 转换格式”yyyy-MM-dd
|
||||
* HH:mm:ss“ * @param text String类型的时间值
|
||||
*/
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
if (StringUtils.hasText(text)) {
|
||||
try {
|
||||
if (text.indexOf(":") == -1 && text.length() == 10) {
|
||||
setValue(DateUtils.date_sdf.get().parse(text));
|
||||
} else if (text.indexOf(":") > 0 && text.length() == 19) {
|
||||
setValue(DateUtils.datetimeFormat.get().parse(text));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Could not parse date, date format is error ");
|
||||
}
|
||||
} catch (ParseException ex) {
|
||||
IllegalArgumentException iae = new IllegalArgumentException("Could not parse date: " + ex.getMessage());
|
||||
iae.initCause(ex);
|
||||
throw iae;
|
||||
}
|
||||
} else {
|
||||
setValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getYear() {
|
||||
GregorianCalendar calendar = new GregorianCalendar();
|
||||
calendar.setTime(getDate());
|
||||
return calendar.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉计算两个long值返回的日期
|
||||
* @Param: [time1, time2]
|
||||
* @Return: int
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/2/10 16:21
|
||||
*/
|
||||
public static int getDiffDay(long time1,long time2){
|
||||
long diff = (time1-time2)/(1000*3600*24);
|
||||
return (int)diff;
|
||||
}
|
||||
|
||||
public static Date solveDaylight(){
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
53
src/main/java/org/gyk/common/util/MyStringUtils.java
Normal file
53
src/main/java/org/gyk/common/util/MyStringUtils.java
Normal file
@ -0,0 +1,53 @@
|
||||
package org.gyk.common.util;
|
||||
|
||||
/**
|
||||
* @Author 闵年泽
|
||||
* @Date 2023/10/9 14:29
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class MyStringUtils {
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉驼峰转下划线命名
|
||||
* @Param: [str]
|
||||
* @Return: java.lang.String
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/10/9 14:29
|
||||
*/
|
||||
public static String toUnderScoreCase(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// 前置字符是否大写
|
||||
boolean preCharIsUpperCase = true;
|
||||
// 当前字符是否大写
|
||||
boolean curreCharIsUpperCase = true;
|
||||
// 下一字符是否大写
|
||||
boolean nexteCharIsUpperCase = true;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
char c = str.charAt(i);
|
||||
if (i > 0) {
|
||||
preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1));
|
||||
} else {
|
||||
preCharIsUpperCase = false;
|
||||
}
|
||||
|
||||
curreCharIsUpperCase = Character.isUpperCase(c);
|
||||
|
||||
if (i < (str.length() - 1)) {
|
||||
nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1));
|
||||
}
|
||||
|
||||
if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) {
|
||||
sb.append("_");
|
||||
} else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) {
|
||||
sb.append("_");
|
||||
}
|
||||
sb.append(Character.toLowerCase(c));
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
85
src/main/java/org/gyk/common/util/SpringContextUtils.java
Normal file
85
src/main/java/org/gyk/common/util/SpringContextUtils.java
Normal file
@ -0,0 +1,85 @@
|
||||
package org.gyk.common.util;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Objects;
|
||||
|
||||
@Component
|
||||
public class SpringContextUtils implements ApplicationContextAware {
|
||||
|
||||
/**
|
||||
* 上下文对象实例
|
||||
*/
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
SpringContextUtils.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取applicationContext
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取HttpServletRequest
|
||||
*/
|
||||
public static HttpServletRequest getHttpServletRequest() {
|
||||
return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||
}
|
||||
|
||||
public static String getDomain(){
|
||||
HttpServletRequest request = getHttpServletRequest();
|
||||
StringBuffer url = request.getRequestURL();
|
||||
return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
|
||||
}
|
||||
|
||||
public static String getOrigin(){
|
||||
HttpServletRequest request = getHttpServletRequest();
|
||||
return request.getHeader("Origin");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过name获取 Bean.
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Object getBean(String name) {
|
||||
return getApplicationContext().getBean(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过class获取Bean.
|
||||
*
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> T getBean(Class<T> clazz) {
|
||||
return getApplicationContext().getBean(clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过name,以及Clazz返回指定的Bean
|
||||
*
|
||||
* @param name
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> T getBean(String name, Class<T> clazz) {
|
||||
return getApplicationContext().getBean(name, clazz);
|
||||
}
|
||||
}
|
118
src/main/java/org/gyk/common/util/SqlInjectionUtil.java
Normal file
118
src/main/java/org/gyk/common/util/SqlInjectionUtil.java
Normal file
@ -0,0 +1,118 @@
|
||||
package org.gyk.common.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* sql注入处理工具类
|
||||
*
|
||||
* @author zhoujf
|
||||
*/
|
||||
@Slf4j
|
||||
public class SqlInjectionUtil {
|
||||
/**
|
||||
* sign 用于表字典加签的盐值【SQL漏洞】
|
||||
* (上线修改值 20200501,同步修改前端的盐值)
|
||||
*/
|
||||
private final static String TABLE_DICT_SIGN_SALT = "20200501";
|
||||
private final static String xssStr = "'|and |exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |;|or |+|,";
|
||||
|
||||
/**
|
||||
* sql注入过滤处理,遇到注入关键字抛异常
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static void filterContent(String value) {
|
||||
if (value == null || "".equals(value)) {
|
||||
return;
|
||||
}
|
||||
// 统一转为小写
|
||||
value = value.toLowerCase();
|
||||
String[] xssArr = xssStr.split("\\|");
|
||||
for (int i = 0; i < xssArr.length; i++) {
|
||||
if (value.indexOf(xssArr[i]) > -1) {
|
||||
log.error("请注意,存在SQL注入关键词---> {}", xssArr[i]);
|
||||
log.error("请注意,值可能存在SQL注入风险!---> {}", value);
|
||||
throw new RuntimeException("请注意,值可能存在SQL注入风险!--->" + value);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* sql注入过滤处理,遇到注入关键字抛异常
|
||||
*
|
||||
* @param values
|
||||
* @return
|
||||
*/
|
||||
public static void filterContent(String[] values) {
|
||||
String[] xssArr = xssStr.split("\\|");
|
||||
for (String value : values) {
|
||||
if (value == null || "".equals(value)) {
|
||||
return;
|
||||
}
|
||||
// 统一转为小写
|
||||
value = value.toLowerCase();
|
||||
for (int i = 0; i < xssArr.length; i++) {
|
||||
if (value.indexOf(xssArr[i]) > -1) {
|
||||
log.error("请注意,存在SQL注入关键词---> {}", xssArr[i]);
|
||||
log.error("请注意,值可能存在SQL注入风险!---> {}", value);
|
||||
throw new RuntimeException("请注意,值可能存在SQL注入风险!--->" + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @特殊方法(不通用) 仅用于字典条件SQL参数,注入过滤
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static void specialFilterContent(String value) {
|
||||
String specialXssStr = " exec | insert | select | delete | update | drop | count | chr | mid | master | truncate | char | declare |;|+|";
|
||||
String[] xssArr = specialXssStr.split("\\|");
|
||||
if (value == null || "".equals(value)) {
|
||||
return;
|
||||
}
|
||||
// 统一转为小写
|
||||
value = value.toLowerCase();
|
||||
for (int i = 0; i < xssArr.length; i++) {
|
||||
if (value.indexOf(xssArr[i]) > -1 || value.startsWith(xssArr[i].trim())) {
|
||||
log.error("请注意,存在SQL注入关键词---> {}", xssArr[i]);
|
||||
log.error("请注意,值可能存在SQL注入风险!---> {}", value);
|
||||
throw new RuntimeException("请注意,值可能存在SQL注入风险!--->" + value);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @特殊方法(不通用) 仅用于Online报表SQL解析,注入过滤
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static void specialFilterContentForOnlineReport(String value) {
|
||||
String specialXssStr = " exec | insert | delete | update | drop | chr | mid | master | truncate | char | declare |";
|
||||
String[] xssArr = specialXssStr.split("\\|");
|
||||
if (value == null || "".equals(value)) {
|
||||
return;
|
||||
}
|
||||
// 统一转为小写
|
||||
value = value.toLowerCase();
|
||||
for (int i = 0; i < xssArr.length; i++) {
|
||||
if (value.indexOf(xssArr[i]) > -1 || value.startsWith(xssArr[i].trim())) {
|
||||
log.error("请注意,存在SQL注入关键词---> {}", xssArr[i]);
|
||||
log.error("请注意,值可能存在SQL注入风险!---> {}", value);
|
||||
throw new RuntimeException("请注意,值可能存在SQL注入风险!--->" + value);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
640
src/main/java/org/gyk/common/util/oConvertUtils.java
Normal file
640
src/main/java/org/gyk/common/util/oConvertUtils.java
Normal file
@ -0,0 +1,640 @@
|
||||
package org.gyk.common.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.sql.Date;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Author 张代浩
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class oConvertUtils {
|
||||
public static boolean isEmpty(Object object) {
|
||||
if (object == null) {
|
||||
return (true);
|
||||
}
|
||||
if ("".equals(object)) {
|
||||
return (true);
|
||||
}
|
||||
if ("null".equals(object)) {
|
||||
return (true);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
public static boolean isNotEmpty(Object object) {
|
||||
if (object != null && !object.equals("") && !object.equals("null")) {
|
||||
return (true);
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
public static String decode(String strIn, String sourceCode, String targetCode) {
|
||||
String temp = code2code(strIn, sourceCode, targetCode);
|
||||
return temp;
|
||||
}
|
||||
|
||||
public static String StrToUTF(String strIn, String sourceCode, String targetCode) {
|
||||
strIn = "";
|
||||
try {
|
||||
strIn = new String(strIn.getBytes("ISO-8859-1"), "GBK");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return strIn;
|
||||
|
||||
}
|
||||
|
||||
private static String code2code(String strIn, String sourceCode, String targetCode) {
|
||||
String strOut = null;
|
||||
if (strIn == null || (strIn.trim()).equals("")) {
|
||||
return strIn;
|
||||
}
|
||||
try {
|
||||
byte[] b = strIn.getBytes(sourceCode);
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
System.out.print(b[i] + " ");
|
||||
}
|
||||
strOut = new String(b, targetCode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return strOut;
|
||||
}
|
||||
|
||||
public static int getInt(String s, int defval) {
|
||||
if (s == null || s == "") {
|
||||
return (defval);
|
||||
}
|
||||
try {
|
||||
return (Integer.parseInt(s));
|
||||
} catch (NumberFormatException e) {
|
||||
return (defval);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getInt(String s) {
|
||||
if (s == null || s == "") {
|
||||
return 0;
|
||||
}
|
||||
try {
|
||||
return (Integer.parseInt(s));
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getInt(String s, Integer df) {
|
||||
if (s == null || s == "") {
|
||||
return df;
|
||||
}
|
||||
try {
|
||||
return (Integer.parseInt(s));
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer[] getInts(String[] s) {
|
||||
Integer[] integer = new Integer[s.length];
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
integer[i] = Integer.parseInt(s[i]);
|
||||
}
|
||||
return integer;
|
||||
|
||||
}
|
||||
|
||||
public static double getDouble(String s, double defval) {
|
||||
if (s == null || s == "") {
|
||||
return (defval);
|
||||
}
|
||||
try {
|
||||
return (Double.parseDouble(s));
|
||||
} catch (NumberFormatException e) {
|
||||
return (defval);
|
||||
}
|
||||
}
|
||||
|
||||
public static double getDou(Double s, double defval) {
|
||||
if (s == null) {
|
||||
return (defval);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/*public static Short getShort(String s) {
|
||||
if (StringUtil.isNotEmpty(s)) {
|
||||
return (Short.parseShort(s));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}*/
|
||||
|
||||
public static int getInt(Object object, int defval) {
|
||||
if (isEmpty(object)) {
|
||||
return (defval);
|
||||
}
|
||||
try {
|
||||
return (Integer.parseInt(object.toString()));
|
||||
} catch (NumberFormatException e) {
|
||||
return (defval);
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer getInt(Object object) {
|
||||
if (isEmpty(object)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return (Integer.parseInt(object.toString()));
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getInt(BigDecimal s, int defval) {
|
||||
if (s == null) {
|
||||
return (defval);
|
||||
}
|
||||
return s.intValue();
|
||||
}
|
||||
|
||||
public static Integer[] getIntegerArry(String[] object) {
|
||||
int len = object.length;
|
||||
Integer[] result = new Integer[len];
|
||||
try {
|
||||
for (int i = 0; i < len; i++) {
|
||||
result[i] = new Integer(object[i].trim());
|
||||
}
|
||||
return result;
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getString(String s) {
|
||||
return (getString(s, ""));
|
||||
}
|
||||
|
||||
/**
|
||||
* 转义成Unicode编码
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
/*public static String escapeJava(Object s) {
|
||||
return StringEscapeUtils.escapeJava(getString(s));
|
||||
}*/
|
||||
|
||||
public static String getString(Object object) {
|
||||
if (isEmpty(object)) {
|
||||
return "";
|
||||
}
|
||||
return (object.toString().trim());
|
||||
}
|
||||
|
||||
public static String getString(int i) {
|
||||
return (String.valueOf(i));
|
||||
}
|
||||
|
||||
public static String getString(float i) {
|
||||
return (String.valueOf(i));
|
||||
}
|
||||
|
||||
public static String getString(String s, String defval) {
|
||||
if (isEmpty(s)) {
|
||||
return (defval);
|
||||
}
|
||||
return (s.trim());
|
||||
}
|
||||
|
||||
public static String getString(Object s, String defval) {
|
||||
if (isEmpty(s)) {
|
||||
return (defval);
|
||||
}
|
||||
return (s.toString().trim());
|
||||
}
|
||||
|
||||
public static long stringToLong(String str) {
|
||||
Long test = new Long(0);
|
||||
try {
|
||||
test = Long.valueOf(str);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return test.longValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本机IP
|
||||
*/
|
||||
public static String getIp() {
|
||||
String ip = null;
|
||||
try {
|
||||
InetAddress address = InetAddress.getLocalHost();
|
||||
ip = address.getHostAddress();
|
||||
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个类是否为基本数据类型。
|
||||
*
|
||||
* @param clazz
|
||||
* 要判断的类。
|
||||
* @return true 表示为基本数据类型。
|
||||
*/
|
||||
private static boolean isBaseDataType(Class clazz) throws Exception {
|
||||
return (clazz.equals(String.class) || clazz.equals(Integer.class) || clazz.equals(Byte.class) || clazz.equals(Long.class) || clazz.equals(Double.class) || clazz.equals(Float.class) || clazz.equals(Character.class) || clazz.equals(Short.class) || clazz.equals(BigDecimal.class) || clazz.equals(BigInteger.class) || clazz.equals(Boolean.class) || clazz.equals(Date.class) || clazz.isPrimitive());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param request
|
||||
* IP
|
||||
* @return IP Address
|
||||
*/
|
||||
public static String getIpAddrByRequest(HttpServletRequest request) {
|
||||
String ip = request.getHeader("x-forwarded-for");
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 本机IP
|
||||
* @throws SocketException
|
||||
*/
|
||||
public static String getRealIp() throws SocketException {
|
||||
String localip = null;// 本地IP,如果没有配置外网IP则返回它
|
||||
String netip = null;// 外网IP
|
||||
|
||||
Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||
InetAddress ip = null;
|
||||
boolean finded = false;// 是否找到外网IP
|
||||
while (netInterfaces.hasMoreElements() && !finded) {
|
||||
NetworkInterface ni = netInterfaces.nextElement();
|
||||
Enumeration<InetAddress> address = ni.getInetAddresses();
|
||||
while (address.hasMoreElements()) {
|
||||
ip = address.nextElement();
|
||||
if (!ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 外网IP
|
||||
netip = ip.getHostAddress();
|
||||
finded = true;
|
||||
break;
|
||||
} else if (ip.isSiteLocalAddress() && !ip.isLoopbackAddress() && ip.getHostAddress().indexOf(":") == -1) {// 内网IP
|
||||
localip = ip.getHostAddress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (netip != null && !"".equals(netip)) {
|
||||
return netip;
|
||||
} else {
|
||||
return localip;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* java去除字符串中的空格、回车、换行符、制表符
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static String replaceBlank(String str) {
|
||||
String dest = "";
|
||||
if (str != null) {
|
||||
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
|
||||
Matcher m = p.matcher(str);
|
||||
dest = m.replaceAll("");
|
||||
}
|
||||
return dest;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断元素是否在数组内
|
||||
*
|
||||
* @param substring
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
public static boolean isIn(String substring, String[] source) {
|
||||
if (source == null || source.length == 0) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < source.length; i++) {
|
||||
String aSource = source[i];
|
||||
if (aSource.equals(substring)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Map对象
|
||||
*/
|
||||
public static Map<Object, Object> getHashMap() {
|
||||
return new HashMap<Object, Object>();
|
||||
}
|
||||
|
||||
/**
|
||||
* SET转换MAP
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static Map<Object, Object> SetToMap(Set<Object> setobj) {
|
||||
Map<Object, Object> map = getHashMap();
|
||||
for (Iterator iterator = setobj.iterator(); iterator.hasNext();) {
|
||||
Map.Entry<Object, Object> entry = (Map.Entry<Object, Object>) iterator.next();
|
||||
map.put(entry.getKey().toString(), entry.getValue() == null ? "" : entry.getValue().toString().trim());
|
||||
}
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isInnerIP(String ipAddress) {
|
||||
boolean isInnerIp = false;
|
||||
long ipNum = getIpNum(ipAddress);
|
||||
/**
|
||||
* 私有IP:A类 10.0.0.0-10.255.255.255 B类 172.16.0.0-172.31.255.255 C类 192.168.0.0-192.168.255.255 当然,还有127这个网段是环回地址
|
||||
**/
|
||||
long aBegin = getIpNum("10.0.0.0");
|
||||
long aEnd = getIpNum("10.255.255.255");
|
||||
long bBegin = getIpNum("172.16.0.0");
|
||||
long bEnd = getIpNum("172.31.255.255");
|
||||
long cBegin = getIpNum("192.168.0.0");
|
||||
long cEnd = getIpNum("192.168.255.255");
|
||||
isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || ipAddress.equals("127.0.0.1");
|
||||
return isInnerIp;
|
||||
}
|
||||
|
||||
private static long getIpNum(String ipAddress) {
|
||||
String[] ip = ipAddress.split("\\.");
|
||||
long a = Integer.parseInt(ip[0]);
|
||||
long b = Integer.parseInt(ip[1]);
|
||||
long c = Integer.parseInt(ip[2]);
|
||||
long d = Integer.parseInt(ip[3]);
|
||||
|
||||
long ipNum = a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
|
||||
return ipNum;
|
||||
}
|
||||
|
||||
private static boolean isInner(long userIp, long begin, long end) {
|
||||
return (userIp >= begin) && (userIp <= end);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将下划线大写方式命名的字符串转换为驼峰式。
|
||||
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
|
||||
* 例如:hello_world->helloWorld
|
||||
*
|
||||
* @param name
|
||||
* 转换前的下划线大写方式命名的字符串
|
||||
* @return 转换后的驼峰式命名的字符串
|
||||
*/
|
||||
public static String camelName(String name) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
// 快速检查
|
||||
if (name == null || name.isEmpty()) {
|
||||
// 没必要转换
|
||||
return "";
|
||||
} else if (!name.contains("_")) {
|
||||
// 不含下划线,仅将首字母小写
|
||||
//update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
|
||||
//update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
|
||||
return name.substring(0, 1).toLowerCase() + name.substring(1).toLowerCase();
|
||||
//update-end--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
|
||||
}
|
||||
// 用下划线将原始字符串分割
|
||||
String camels[] = name.split("_");
|
||||
for (String camel : camels) {
|
||||
// 跳过原始字符串中开头、结尾的下换线或双重下划线
|
||||
if (camel.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
// 处理真正的驼峰片段
|
||||
if (result.length() == 0) {
|
||||
// 第一个驼峰片段,全部字母都小写
|
||||
result.append(camel.toLowerCase());
|
||||
} else {
|
||||
// 其他的驼峰片段,首字母大写
|
||||
result.append(camel.substring(0, 1).toUpperCase());
|
||||
result.append(camel.substring(1).toLowerCase());
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将下划线大写方式命名的字符串转换为驼峰式。
|
||||
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
|
||||
* 例如:hello_world,test_id->helloWorld,testId
|
||||
*
|
||||
* @param names
|
||||
* 转换前的下划线大写方式命名的字符串
|
||||
* @return 转换后的驼峰式命名的字符串
|
||||
*/
|
||||
public static String camelNames(String names) {
|
||||
if(names==null||names.equals("")){
|
||||
return null;
|
||||
}
|
||||
StringBuffer sf = new StringBuffer();
|
||||
String[] fs = names.split(",");
|
||||
for (String field : fs) {
|
||||
field = camelName(field);
|
||||
sf.append(field + ",");
|
||||
}
|
||||
String result = sf.toString();
|
||||
return result.substring(0, result.length() - 1);
|
||||
}
|
||||
|
||||
//update-begin--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
|
||||
/**
|
||||
* 将下划线大写方式命名的字符串转换为驼峰式。(首字母写)
|
||||
* 如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br>
|
||||
* 例如:hello_world->HelloWorld
|
||||
*
|
||||
* @param name
|
||||
* 转换前的下划线大写方式命名的字符串
|
||||
* @return 转换后的驼峰式命名的字符串
|
||||
*/
|
||||
public static String camelNameCapFirst(String name) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
// 快速检查
|
||||
if (name == null || name.isEmpty()) {
|
||||
// 没必要转换
|
||||
return "";
|
||||
} else if (!name.contains("_")) {
|
||||
// 不含下划线,仅将首字母小写
|
||||
return name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase();
|
||||
}
|
||||
// 用下划线将原始字符串分割
|
||||
String camels[] = name.split("_");
|
||||
for (String camel : camels) {
|
||||
// 跳过原始字符串中开头、结尾的下换线或双重下划线
|
||||
if (camel.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
// 其他的驼峰片段,首字母大写
|
||||
result.append(camel.substring(0, 1).toUpperCase());
|
||||
result.append(camel.substring(1).toLowerCase());
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
//update-end--Author:zhoujf Date:20180503 for:TASK #2500 【代码生成器】代码生成器开发一通用模板生成功能
|
||||
|
||||
/**
|
||||
* 将驼峰命名转化成下划线
|
||||
* @param para
|
||||
* @return
|
||||
*/
|
||||
public static String camelToUnderline(String para){
|
||||
if(para.length()<3){
|
||||
return para.toLowerCase();
|
||||
}
|
||||
StringBuilder sb=new StringBuilder(para);
|
||||
int temp=0;//定位
|
||||
//从第二个字符开始 避免命名不规范 修改成第二个字符开始 by 闵
|
||||
for(int i=1;i<para.length();i++){
|
||||
if(Character.isUpperCase(para.charAt(i))){
|
||||
sb.insert(i+temp, "_");
|
||||
temp+=1;
|
||||
}
|
||||
}
|
||||
return sb.toString().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机数
|
||||
* @param place 定义随机数的位数
|
||||
*/
|
||||
public static String randomGen(int place) {
|
||||
String base = "qwertyuioplkjhgfdsazxcvbnmQAZWSXEDCRFVTGBYHNUJMIKLOP0123456789";
|
||||
StringBuffer sb = new StringBuffer();
|
||||
Random rd = new Random();
|
||||
for(int i=0;i<place;i++) {
|
||||
sb.append(base.charAt(rd.nextInt(base.length())));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类的所有属性,包括父类
|
||||
*
|
||||
* @param object
|
||||
* @return
|
||||
*/
|
||||
public static Field[] getAllFields(Object object) {
|
||||
Class<?> clazz = object.getClass();
|
||||
List<Field> fieldList = new ArrayList<>();
|
||||
while (clazz != null) {
|
||||
fieldList.addAll(new ArrayList<>(Arrays.asList(clazz.getDeclaredFields())));
|
||||
clazz = clazz.getSuperclass();
|
||||
}
|
||||
Field[] fields = new Field[fieldList.size()];
|
||||
fieldList.toArray(fields);
|
||||
return fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将map的key全部转成小写
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> toLowerCasePageList(List<Map<String, Object>> list){
|
||||
List<Map<String, Object>> select = new ArrayList<>();
|
||||
for (Map<String, Object> row : list) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
Set<String> keySet = row.keySet();
|
||||
for (String key : keySet) {
|
||||
String newKey = key.toLowerCase();
|
||||
resultMap.put(newKey, row.get(key));
|
||||
}
|
||||
select.add(resultMap);
|
||||
}
|
||||
return select;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将entityList转换成modelList
|
||||
* @param fromList
|
||||
* @param tClass
|
||||
* @param <F>
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static<F,T> List<T> entityListToModelList(List<F> fromList, Class<T> tClass){
|
||||
if(fromList.isEmpty() || fromList == null){
|
||||
return null;
|
||||
}
|
||||
List<T> tList = new ArrayList<>();
|
||||
for(F f : fromList){
|
||||
T t = entityToModel(f, tClass);
|
||||
tList.add(t);
|
||||
}
|
||||
return tList;
|
||||
}
|
||||
|
||||
public static<F,T> T entityToModel(F entity, Class<T> modelClass) {
|
||||
log.debug("entityToModel : Entity属性的值赋值到Model");
|
||||
Object model = null;
|
||||
if (entity == null || modelClass ==null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
model = modelClass.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
log.error("entityToModel : 实例化异常", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
log.error("entityToModel : 安全权限异常", e);
|
||||
}
|
||||
BeanUtils.copyProperties(entity, model);
|
||||
return (T)model;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断 list 是否为空
|
||||
*
|
||||
* @param list
|
||||
* @return true or false
|
||||
* list == null : true
|
||||
* list.size() == 0 : true
|
||||
*/
|
||||
public static boolean listIsEmpty(Collection list) {
|
||||
return (list == null || list.size() == 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
144
src/main/java/org/gyk/common/vo/SysPermissionDataRuleModel.java
Normal file
144
src/main/java/org/gyk/common/vo/SysPermissionDataRuleModel.java
Normal file
@ -0,0 +1,144 @@
|
||||
package org.gyk.common.vo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单权限规则表
|
||||
* </p>
|
||||
*
|
||||
* @Author huangzhilin
|
||||
* @since 2019-03-29
|
||||
*/
|
||||
public class SysPermissionDataRuleModel {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 对应的菜单id
|
||||
*/
|
||||
private String permissionId;
|
||||
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
private String ruleName;
|
||||
|
||||
/**
|
||||
* 字段
|
||||
*/
|
||||
private String ruleColumn;
|
||||
|
||||
/**
|
||||
* 条件
|
||||
*/
|
||||
private String ruleConditions;
|
||||
|
||||
/**
|
||||
* 规则值
|
||||
*/
|
||||
private String ruleValue;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPermissionId() {
|
||||
return permissionId;
|
||||
}
|
||||
|
||||
public void setPermissionId(String permissionId) {
|
||||
this.permissionId = permissionId;
|
||||
}
|
||||
|
||||
public String getRuleName() {
|
||||
return ruleName;
|
||||
}
|
||||
|
||||
public void setRuleName(String ruleName) {
|
||||
this.ruleName = ruleName;
|
||||
}
|
||||
|
||||
public String getRuleColumn() {
|
||||
return ruleColumn;
|
||||
}
|
||||
|
||||
public void setRuleColumn(String ruleColumn) {
|
||||
this.ruleColumn = ruleColumn;
|
||||
}
|
||||
|
||||
public String getRuleConditions() {
|
||||
return ruleConditions;
|
||||
}
|
||||
|
||||
public void setRuleConditions(String ruleConditions) {
|
||||
this.ruleConditions = ruleConditions;
|
||||
}
|
||||
|
||||
public String getRuleValue() {
|
||||
return ruleValue;
|
||||
}
|
||||
|
||||
public void setRuleValue(String ruleValue) {
|
||||
this.ruleValue = ruleValue;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
}
|
39
src/main/java/org/gyk/modules/App.java
Normal file
39
src/main/java/org/gyk/modules/App.java
Normal file
@ -0,0 +1,39 @@
|
||||
package org.gyk.modules;
|
||||
|
||||
import org.gyk.modules.sssj.util.*;
|
||||
import org.gyk.modules.websocket.webSocket;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@ServletComponentScan(basePackages = {"org.gyk.modules.sssj","org.gyk.modules.sz","org.gyk.modules.lssj","org.gyk.modules.websocket"})
|
||||
@EnableScheduling
|
||||
@EnableAsync
|
||||
@EnableCaching
|
||||
@ComponentScan(basePackages = {"org.gyk.modules","org.gyk.modules.sssj","org.gyk.modules.sz","org.gyk.modules.lssj","org.gyk.modules.jlgl","org.gyk.modules.websocket"})
|
||||
@EnableTransactionManagement
|
||||
@SpringBootApplication(scanBasePackages="org.gyk.modules",exclude = DataSourceAutoConfiguration.class)
|
||||
public class App {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(App.class, args);
|
||||
|
||||
// new saveBj("保存报警历史",new webSocket()).start();
|
||||
|
||||
// new YasuojBj("保存压缩机报警历史",new webSocket()).start();
|
||||
|
||||
// new saveKrBj("保存可燃气体报警历史",new webSocket()).start();
|
||||
//发布时要去掉注释
|
||||
// new saveYasuojiData().start();
|
||||
|
||||
// new saveData("保存计量点实时数据").start();
|
||||
|
||||
// new saveNgzxData("保存能管中心数据").start();
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
package org.gyk.modules.jlgl.controller;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gyk.common.api.Result;
|
||||
import org.gyk.common.query.QueryGenerator;
|
||||
import org.gyk.common.util.MyStringUtils;
|
||||
import org.gyk.modules.jlgl.entity.CxcJlQjglJlqjtz;
|
||||
import org.gyk.modules.jlgl.service.ICxcJlQjglJlqjtzService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: cxc_jl_qjgl_jlqjtz
|
||||
* @Author: jiang
|
||||
* @Date: 2023-09-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||
@Api(tags="cxc_jl_qjgl_jlqjtz")
|
||||
@RestController
|
||||
@RequestMapping("/jlgltz/cxcJlQjglJlqjtz")
|
||||
@Slf4j
|
||||
//查询局里计量管理数据库中的天然气产销厂的所有数据,存入到自己的数据库中
|
||||
public class jlglController {
|
||||
@Autowired
|
||||
private ICxcJlQjglJlqjtzService cxcJlQjglJlqjtzService;
|
||||
|
||||
/**
|
||||
* 更新计量点数据库
|
||||
* 可以主动
|
||||
* 定时每周六凌晨2点更新一次
|
||||
* @return
|
||||
*/
|
||||
// cron表达式从左到右(用空格隔开):秒 分 小时 日期 月份 星期 年份
|
||||
// 年份可以不填
|
||||
// @Scheduled(cron = "0 0 2 ? * 7")
|
||||
// @GetMapping(value = "/updateNow")
|
||||
// public Result<?> queryById() {
|
||||
// String msg = cxcJlQjglJlqjtzService.queryMaster();
|
||||
// return Result.ok(msg);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param cxcJlQjglJlqjtz
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
// @ApiOperation(value="信息化支持中心周报主表-分页列表查询", notes="信息化支持中心周报主表-分页列表查询")
|
||||
// @GetMapping(value = "/list1")
|
||||
// public Result<?> queryPageList(CxcJlQjglJlqjtz cxcJlQjglJlqjtz,
|
||||
// @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
// @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
// HttpServletRequest req) {
|
||||
// Field[] declaredFields = cxcJlQjglJlqjtz.getClass().getDeclaredFields();
|
||||
// Map<String,String> selectMap = new HashMap<>();
|
||||
// for (Field field : declaredFields) {
|
||||
// field.setAccessible(true); // 设置字段可访问
|
||||
// try {
|
||||
// Object value = field.get(cxcJlQjglJlqjtz);
|
||||
// String name = field.getName();
|
||||
// if (value!=null&&!"serialVersionUID".equals(name)){
|
||||
// String slelctValue = value.toString();
|
||||
// selectMap.put(MyStringUtils.toUnderScoreCase(name),slelctValue);
|
||||
// }
|
||||
// } catch (IllegalAccessException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// QueryWrapper<CxcJlQjglJlqjtz> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.like("f_gldwbh","S010107");
|
||||
// queryWrapper.allEq(selectMap);
|
||||
// List<CxcJlQjglJlqjtz> list = cxcJlQjglJlqjtzService.list(queryWrapper);
|
||||
// Page page = new Page();
|
||||
// page.setRecords(list);
|
||||
// return Result.ok(page);
|
||||
// }
|
||||
|
||||
@ApiOperation(value="气井基础资料-分页列表查询", notes="气井基础资料-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<?> queryPageList(CxcJlQjglJlqjtz cxcJlQjglJlqjtz,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<CxcJlQjglJlqjtz> queryWrapper = QueryGenerator.initQueryWrapper(cxcJlQjglJlqjtz, req.getParameterMap(),false);
|
||||
// QueryWrapper<CxcJlQjglJlqjtz> queryWrapper = new QueryWrapper<>();
|
||||
//加载产销厂数据
|
||||
queryWrapper.like("F_GLDWBH","S010107%");
|
||||
try {
|
||||
Page<CxcJlQjglJlqjtz> page = new Page<CxcJlQjglJlqjtz>(pageNo, pageSize);
|
||||
IPage<CxcJlQjglJlqjtz> pageList = cxcJlQjglJlqjtzService.page(page, queryWrapper);
|
||||
return Result.ok(pageList);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return Result.ok("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉获取单位
|
||||
* @Param: []
|
||||
* @Return: org.gyk.common.api.Result<?>
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/10/9 9:13
|
||||
*/
|
||||
@GetMapping("/getDw")
|
||||
public Result<?> getDw(){
|
||||
List<String> dwList = cxcJlQjglJlqjtzService.getDw();
|
||||
return Result.ok(dwList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉获取站场
|
||||
* @Param: [dw]
|
||||
* @Return: org.gyk.common.api.Result<?>
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/10/9 10:06
|
||||
*/
|
||||
@GetMapping("/getZc")
|
||||
public Result<?> getZc(@RequestParam String dw){
|
||||
List<String> zcList = cxcJlQjglJlqjtzService.getZc(dw);
|
||||
return Result.ok(zcList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉获取设备名称
|
||||
* @Param: [zc]
|
||||
* @Return: org.gyk.common.api.Result<?>
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/10/9 10:07
|
||||
*/
|
||||
@GetMapping("/getSbmc")
|
||||
public Result<?> getSbmc(@RequestParam String zc){
|
||||
List<String> sbmcList = cxcJlQjglJlqjtzService.getSbmc(zc);
|
||||
return Result.ok(sbmcList);
|
||||
}
|
||||
}
|
377
src/main/java/org/gyk/modules/jlgl/entity/CxcJlQjglJlqjtz.java
Normal file
377
src/main/java/org/gyk/modules/jlgl/entity/CxcJlQjglJlqjtz.java
Normal file
@ -0,0 +1,377 @@
|
||||
package org.gyk.modules.jlgl.entity;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: cxc_jl_qjgl_jlqjtz
|
||||
* @Author: jiang
|
||||
* @Date: 2023-09-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@DS("jlglDb")
|
||||
@TableName("Jl_Qjgl_Jlqjtz")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cxc_jl_qjgl_jlqjtz对象", description="cxc_jl_qjgl_jlqjtz")
|
||||
public class CxcJlQjglJlqjtz implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**单井编号*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
@Excel(name = "单井编号", width = 15)
|
||||
@ApiModelProperty(value = "单井编号")
|
||||
private String FDjbh;
|
||||
/**管理单位编号*/
|
||||
@Excel(name = "管理单位编号", width = 15)
|
||||
@ApiModelProperty(value = "管理单位编号")
|
||||
private String FGldwbh;
|
||||
/**管理单位名称*/
|
||||
@Excel(name = "管理单位名称", width = 15)
|
||||
@ApiModelProperty(value = "管理单位名称")
|
||||
private String FGldwmc;
|
||||
/**单位全称*/
|
||||
@Excel(name = "单位全称", width = 15)
|
||||
@ApiModelProperty(value = "单位全称")
|
||||
private String FDwqc;
|
||||
/**所处站场编号*/
|
||||
@Excel(name = "所处站场编号", width = 15)
|
||||
@ApiModelProperty(value = "所处站场编号")
|
||||
private String FSczzbh;
|
||||
/**所处站场名称*/
|
||||
@Excel(name = "所处站场名称", width = 15)
|
||||
@ApiModelProperty(value = "所处站场名称")
|
||||
private String FSczzmc;
|
||||
/**计量点编号*/
|
||||
@Excel(name = "计量点编号", width = 15)
|
||||
@ApiModelProperty(value = "计量点编号")
|
||||
private String FJldbh;
|
||||
/**计量点名称*/
|
||||
@Excel(name = "计量点名称", width = 15)
|
||||
@ApiModelProperty(value = "计量点名称")
|
||||
private String FJldmc;
|
||||
/**测量范围*/
|
||||
@Excel(name = "测量范围", width = 15)
|
||||
@ApiModelProperty(value = "测量范围")
|
||||
private String FBhfw;
|
||||
/**准确度等级要求*/
|
||||
@Excel(name = "准确度等级要求", width = 15)
|
||||
@ApiModelProperty(value = "准确度等级要求")
|
||||
private String FZqddjyq;
|
||||
/**日期*/
|
||||
@Excel(name = "日期", width = 15)
|
||||
@ApiModelProperty(value = "日期")
|
||||
private String FDate;
|
||||
/**器具类别编号*/
|
||||
@Excel(name = "器具类别编号", width = 15)
|
||||
@ApiModelProperty(value = "器具类别编号")
|
||||
private String FQjlbbh;
|
||||
/**器具类别名称*/
|
||||
@Excel(name = "器具类别名称", width = 15)
|
||||
@ApiModelProperty(value = "器具类别名称")
|
||||
private String FQjlbmc;
|
||||
/**生产厂家编号*/
|
||||
@Excel(name = "生产厂家编号", width = 15)
|
||||
@ApiModelProperty(value = "生产厂家编号")
|
||||
private String FSccjbh;
|
||||
/**生产厂家名称*/
|
||||
@Excel(name = "生产厂家名称", width = 15)
|
||||
@ApiModelProperty(value = "生产厂家名称")
|
||||
private String FSccjmc;
|
||||
/**GG型号编号*/
|
||||
@Excel(name = "GG型号编号", width = 15)
|
||||
@ApiModelProperty(value = "GG型号编号")
|
||||
private String FGgxhbh;
|
||||
/**测量范围编号*/
|
||||
@Excel(name = "测量范围编号", width = 15)
|
||||
@ApiModelProperty(value = "测量范围编号")
|
||||
private String FClfwbh;
|
||||
/**测量范围名称*/
|
||||
@Excel(name = "测量范围名称", width = 15)
|
||||
@ApiModelProperty(value = "测量范围名称")
|
||||
private String FClfwmc;
|
||||
/**准确度等级编号*/
|
||||
@Excel(name = "准确度等级编号", width = 15)
|
||||
@ApiModelProperty(value = "准确度等级编号")
|
||||
private String FZqddjbh;
|
||||
/**准确度等级名称*/
|
||||
@Excel(name = "准确度等级名称", width = 15)
|
||||
@ApiModelProperty(value = "准确度等级名称")
|
||||
private String FZqddjmc;
|
||||
/**GG型号名称*/
|
||||
@Excel(name = "GG型号名称", width = 15)
|
||||
@ApiModelProperty(value = "GG型号名称")
|
||||
private String FGgxhmc;
|
||||
/**测量介质编号*/
|
||||
@Excel(name = "测量介质编号", width = 15)
|
||||
@ApiModelProperty(value = "测量介质编号")
|
||||
private String FCljzbh;
|
||||
/**测量介质名称*/
|
||||
@Excel(name = "测量介质名称", width = 15)
|
||||
@ApiModelProperty(value = "测量介质名称")
|
||||
private String FCljzmc;
|
||||
/**测量CS编号*/
|
||||
@Excel(name = "测量CS编号", width = 15)
|
||||
@ApiModelProperty(value = "测量CS编号")
|
||||
private String FClcsbh;
|
||||
/**测量CS名称*/
|
||||
@Excel(name = "测量CS名称", width = 15)
|
||||
@ApiModelProperty(value = "测量CS名称")
|
||||
private String FClcsmc;
|
||||
/**CC编号*/
|
||||
@Excel(name = "CC编号", width = 15)
|
||||
@ApiModelProperty(value = "CC编号")
|
||||
private String FCcbh;
|
||||
/**Z编号*/
|
||||
@Excel(name = "Z编号", width = 15)
|
||||
@ApiModelProperty(value = "Z编号")
|
||||
private String FZbh;
|
||||
/**商业性质*/
|
||||
@Excel(name = "商业性质", width = 15)
|
||||
@ApiModelProperty(value = "商业性质")
|
||||
private String FSyxz;
|
||||
/**启用日期*/
|
||||
@Excel(name = "启用日期", width = 15)
|
||||
@ApiModelProperty(value = "启用日期")
|
||||
private String FQyrq;
|
||||
/**ZS编号*/
|
||||
@Excel(name = "ZS编号", width = 15)
|
||||
@ApiModelProperty(value = "ZS编号")
|
||||
private String FZsbh;
|
||||
/**fSfsj*/
|
||||
@Excel(name = "fSfsj", width = 15)
|
||||
@ApiModelProperty(value = "fSfsj")
|
||||
private String FSfsj;
|
||||
/**检定日期*/
|
||||
@Excel(name = "检定日期", width = 15)
|
||||
@ApiModelProperty(value = "检定日期")
|
||||
private String FJdrq;
|
||||
/**检定周期(月)*/
|
||||
@Excel(name = "检定周期(月)", width = 15)
|
||||
@ApiModelProperty(value = "检定周期(月)")
|
||||
private String FJdzq;
|
||||
/**YX日期*/
|
||||
@Excel(name = "YX日期", width = 15)
|
||||
@ApiModelProperty(value = "YX日期")
|
||||
private String FYxrq;
|
||||
/**确认日期*/
|
||||
@Excel(name = "确认日期", width = 15)
|
||||
@ApiModelProperty(value = "确认日期")
|
||||
private String FQrrq;
|
||||
/**检定单位编号*/
|
||||
@Excel(name = "检定单位编号", width = 15)
|
||||
@ApiModelProperty(value = "检定单位编号")
|
||||
private String FJddwbh;
|
||||
/**检定单位名称*/
|
||||
@Excel(name = "检定单位名称", width = 15)
|
||||
@ApiModelProperty(value = "检定单位名称")
|
||||
private String FJddwmc;
|
||||
/**检定费用*/
|
||||
@Excel(name = "检定费用", width = 15)
|
||||
@ApiModelProperty(value = "检定费用")
|
||||
private String FJdfy;
|
||||
/**检定JG*/
|
||||
@Excel(name = "检定JG", width = 15)
|
||||
@ApiModelProperty(value = "检定JG")
|
||||
private String FJdjg;
|
||||
/**fTxqk*/
|
||||
@Excel(name = "fTxqk", width = 15)
|
||||
@ApiModelProperty(value = "fTxqk")
|
||||
private String FTxqk;
|
||||
/**标准器*/
|
||||
@Excel(name = "标准器", width = 15)
|
||||
@ApiModelProperty(value = "标准器")
|
||||
private String FBzq;
|
||||
/**fAqfh*/
|
||||
@Excel(name = "fAqfh", width = 15)
|
||||
@ApiModelProperty(value = "fAqfh")
|
||||
private String FAqfh;
|
||||
/**fHjjc*/
|
||||
@Excel(name = "fHjjc", width = 15)
|
||||
@ApiModelProperty(value = "fHjjc")
|
||||
private String FHjjc;
|
||||
/**fMyjs*/
|
||||
@Excel(name = "fMyjs", width = 15)
|
||||
@ApiModelProperty(value = "fMyjs")
|
||||
private String FMyjs;
|
||||
/**fZljc*/
|
||||
@Excel(name = "fZljc", width = 15)
|
||||
@ApiModelProperty(value = "fZljc")
|
||||
private String FZljc;
|
||||
/**fYlws*/
|
||||
@Excel(name = "fYlws", width = 15)
|
||||
@ApiModelProperty(value = "fYlws")
|
||||
private String FYlws;
|
||||
/**fGykz*/
|
||||
@Excel(name = "fGykz", width = 15)
|
||||
@ApiModelProperty(value = "fGykz")
|
||||
private String FGykz;
|
||||
/**fCnjs*/
|
||||
@Excel(name = "fCnjs", width = 15)
|
||||
@ApiModelProperty(value = "fCnjs")
|
||||
private String FCnjs;
|
||||
/**fSyzy*/
|
||||
@Excel(name = "fSyzy", width = 15)
|
||||
@ApiModelProperty(value = "fSyzy")
|
||||
private String FSyzy;
|
||||
/**fHnjs*/
|
||||
@Excel(name = "fHnjs", width = 15)
|
||||
@ApiModelProperty(value = "fHnjs")
|
||||
private String FHnjs;
|
||||
/**fHnjlxq*/
|
||||
@Excel(name = "fHnjlxq", width = 15)
|
||||
@ApiModelProperty(value = "fHnjlxq")
|
||||
private String FHnjlxq;
|
||||
/**fQjzt*/
|
||||
@Excel(name = "fQjzt", width = 15)
|
||||
@ApiModelProperty(value = "fQjzt")
|
||||
private String FQjzt;
|
||||
/**检定类别*/
|
||||
@Excel(name = "检定类别", width = 15)
|
||||
@ApiModelProperty(value = "检定类别")
|
||||
private String FJdlb;
|
||||
/**fAbclb*/
|
||||
@Excel(name = "fAbclb", width = 15)
|
||||
@ApiModelProperty(value = "fAbclb")
|
||||
private String FAbclb;
|
||||
/**fBfrq*/
|
||||
@Excel(name = "fBfrq", width = 15)
|
||||
@ApiModelProperty(value = "fBfrq")
|
||||
private String FBfrq;
|
||||
/**fBfyy*/
|
||||
@Excel(name = "fBfyy", width = 15)
|
||||
@ApiModelProperty(value = "fBfyy")
|
||||
private String FBfyy;
|
||||
/**fSfnyqj*/
|
||||
@Excel(name = "fSfnyqj", width = 15)
|
||||
@ApiModelProperty(value = "fSfnyqj")
|
||||
private String FSfnyqj;
|
||||
/**fYnsblxbh*/
|
||||
@Excel(name = "fYnsblxbh", width = 15)
|
||||
@ApiModelProperty(value = "fYnsblxbh")
|
||||
private String FYnsblxbh;
|
||||
/**fYnsblxmc*/
|
||||
@Excel(name = "fYnsblxmc", width = 15)
|
||||
@ApiModelProperty(value = "fYnsblxmc")
|
||||
private String FYnsblxmc;
|
||||
/**设备编号*/
|
||||
@Excel(name = "设备编号", width = 15)
|
||||
@ApiModelProperty(value = "设备编号")
|
||||
private String FSbbh;
|
||||
/**设备名称*/
|
||||
@Excel(name = "设备名称", width = 15)
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private String FSbmc;
|
||||
/**fYnzlbh*/
|
||||
@Excel(name = "fYnzlbh", width = 15)
|
||||
@ApiModelProperty(value = "fYnzlbh")
|
||||
private String FYnzlbh;
|
||||
/**fYnzlmc*/
|
||||
@Excel(name = "fYnzlmc", width = 15)
|
||||
@ApiModelProperty(value = "fYnzlmc")
|
||||
private String FYnzlmc;
|
||||
/**fNyxhl*/
|
||||
@Excel(name = "fNyxhl", width = 15)
|
||||
@ApiModelProperty(value = "fNyxhl")
|
||||
private String FNyxhl;
|
||||
/**fSyzt*/
|
||||
@Excel(name = "fSyzt", width = 15)
|
||||
@ApiModelProperty(value = "fSyzt")
|
||||
private String FSyzt;
|
||||
/**维护人账号*/
|
||||
@Excel(name = "维护人账号", width = 15)
|
||||
@ApiModelProperty(value = "维护人账号")
|
||||
private String FWhr;
|
||||
/**维护人姓名*/
|
||||
@Excel(name = "维护人姓名", width = 15)
|
||||
@ApiModelProperty(value = "维护人姓名")
|
||||
private String FWhrmc;
|
||||
/**维护日期*/
|
||||
@Excel(name = "维护日期", width = 15)
|
||||
@ApiModelProperty(value = "维护日期")
|
||||
private String FWhrq;
|
||||
/**维护人单位编号*/
|
||||
@Excel(name = "维护人单位编号", width = 15)
|
||||
@ApiModelProperty(value = "维护人单位编号")
|
||||
private String FWhrdwbh;
|
||||
/**维护人单位名称*/
|
||||
@Excel(name = "维护人单位名称", width = 15)
|
||||
@ApiModelProperty(value = "维护人单位名称")
|
||||
private String FWhrdwmc;
|
||||
/**维护人单位区场*/
|
||||
@Excel(name = "维护人单位区场", width = 15)
|
||||
@ApiModelProperty(value = "维护人单位区场")
|
||||
private String FWhrdwqc;
|
||||
/**信息*/
|
||||
@Excel(name = "信息", width = 15)
|
||||
@ApiModelProperty(value = "信息")
|
||||
private String FNote;
|
||||
/**fQjflbh*/
|
||||
@Excel(name = "fQjflbh", width = 15)
|
||||
@ApiModelProperty(value = "fQjflbh")
|
||||
private String FQjflbh;
|
||||
/**fTxmbh*/
|
||||
@Excel(name = "fTxmbh", width = 15)
|
||||
@ApiModelProperty(value = "fTxmbh")
|
||||
private String FTxmbh;
|
||||
/**fTxmzt*/
|
||||
@Excel(name = "fTxmzt", width = 15)
|
||||
@ApiModelProperty(value = "fTxmzt")
|
||||
private String FTxmzt;
|
||||
/**fExt1*/
|
||||
@Excel(name = "fExt1", width = 15)
|
||||
@ApiModelProperty(value = "fExt1")
|
||||
private String FExt1;
|
||||
/**fExt2*/
|
||||
@Excel(name = "fExt2", width = 15)
|
||||
@ApiModelProperty(value = "fExt2")
|
||||
private String FExt2;
|
||||
/**fExt3*/
|
||||
@Excel(name = "fExt3", width = 15)
|
||||
@ApiModelProperty(value = "fExt3")
|
||||
private String FExt3;
|
||||
/**fNbjj*/
|
||||
@Excel(name = "fNbjj", width = 15)
|
||||
@ApiModelProperty(value = "fNbjj")
|
||||
private String FNbjj;
|
||||
/**fGgxh*/
|
||||
@Excel(name = "fGgxh", width = 15)
|
||||
@ApiModelProperty(value = "fGgxh")
|
||||
private String FGgxh;
|
||||
/**安装位置*/
|
||||
@Excel(name = "安装位置", width = 15)
|
||||
@ApiModelProperty(value = "安装位置")
|
||||
private String FAzwz;
|
||||
/**创建时间*/
|
||||
@Excel(name = "创建时间", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date FCrdate;
|
||||
/**更新时间*/
|
||||
@Excel(name = "更新时间", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date FChdate;
|
||||
/**fCkjdfy*/
|
||||
@Excel(name = "fCkjdfy", width = 15)
|
||||
@ApiModelProperty(value = "fCkjdfy")
|
||||
private String FCkjdfy;
|
||||
/**fExt4*/
|
||||
@Excel(name = "fExt4", width = 15)
|
||||
@ApiModelProperty(value = "fExt4")
|
||||
private String FExt4;
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package org.gyk.modules.jlgl.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.gyk.modules.jlgl.entity.CxcJlQjglJlqjtz;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: cxc_jl_qjgl_jlqjtz
|
||||
* 从局计量点数据库查询出所需数据
|
||||
* @Author: jiang
|
||||
* @Date: 2023-09-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
@DS("jlglDb")
|
||||
public interface CxcJlQjglJlqjtzMapper extends BaseMapper<CxcJlQjglJlqjtz> {
|
||||
|
||||
// //主库
|
||||
// @Select("select * from Jl_Qjgl_Jlqjtz ")
|
||||
// List<CxcJlQjglJlqjtz> queryMaster();
|
||||
|
||||
//从库
|
||||
//把产销厂的数据查询出来
|
||||
@Select("select distinct * from Jl_Qjgl_Jlqjtz t where t.f_gldwbh like 'S010107%' ")
|
||||
List<CxcJlQjglJlqjtz> queryJldData();
|
||||
|
||||
//查询局数据库中的数据
|
||||
@Select("select distinct * from Jl_Qjgl_Jlqjtz t where t.F_GLDWBH like 'S010107%' AND F_DWQC = #{dwqc} AND ")
|
||||
List<CxcJlQjglJlqjtz> queryJuDate();
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉获取单位
|
||||
* @Param: []
|
||||
* @Return: java.util.List<java.lang.String>
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/10/9 8:21
|
||||
*/
|
||||
@Select("select distinct f_dwqc from Jl_Qjgl_Jlqjtz t where t.f_gldwbh like 'S010107%' ")
|
||||
List<String> getDw();
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉获取战场
|
||||
* @Param: [dw]
|
||||
* @Return: java.util.List<java.lang.String>
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/10/9 8:47
|
||||
*/
|
||||
@Select("select distinct F_SCZZMC from Jl_Qjgl_Jlqjtz where F_DWQC like '%'||#{dw}||'%' ")
|
||||
List<String> getZc(String dw);
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉获取设备名称
|
||||
* @Param: [zc]
|
||||
* @Return: java.util.List<java.lang.String>
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/10/9 8:47
|
||||
*/
|
||||
@Select("select distinct f_qjlbmc from Jl_Qjgl_Jlqjtz t where t.f_gldwbh like 'S010107%' and f_sczzmc=#{zc}")
|
||||
List<String> getSbmc(String zc);
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.gyk.modules.jlgl.mapper.CxcJlQjglJlqjtzMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,51 @@
|
||||
package org.gyk.modules.jlgl.service;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import org.gyk.modules.jlgl.entity.CxcJlQjglJlqjtz;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: cxc_jl_qjgl_jlqjtz
|
||||
* @Author: jiang
|
||||
* @Date: 2023-09-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@DS("jlglDb")
|
||||
public interface ICxcJlQjglJlqjtzService extends IService<CxcJlQjglJlqjtz> {
|
||||
|
||||
//新增局计量系统数据
|
||||
String queryMaster();
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉计量二维码获取单位
|
||||
* @Param: []
|
||||
* @Return: void
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/10/8 16:56
|
||||
*/
|
||||
public List<String> getDw();
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉获取站场
|
||||
* @Param: [dw]
|
||||
* @Return: java.util.List<java.lang.String>
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/10/9 10:04
|
||||
*/
|
||||
public List<String> getZc(String dw);
|
||||
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
* 〈〉获取设备名称
|
||||
* @Param: [zc]
|
||||
* @Return: java.util.List<java.lang.String>
|
||||
* @Author: 闵年泽
|
||||
* @Date: 2023/10/9 10:05
|
||||
*/
|
||||
public List<String> getSbmc(String zc);
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package org.gyk.modules.jlgl.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.gyk.modules.jlgl.entity.CxcJlQjglJlqjtz;
|
||||
import org.gyk.modules.jlgl.mapper.CxcJlQjglJlqjtzMapper;
|
||||
import org.gyk.modules.jlgl.service.ICxcJlQjglJlqjtzService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: cxc_jl_qjgl_jlqjtz
|
||||
* @Author: jiang
|
||||
* @Date: 2023-09-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class CxcJlQjglJlqjtzServiceImpl extends ServiceImpl<CxcJlQjglJlqjtzMapper, CxcJlQjglJlqjtz> implements ICxcJlQjglJlqjtzService {
|
||||
|
||||
@Autowired
|
||||
private CxcJlQjglJlqjtzMapper cxcJlQjglJlqjtzMapper;
|
||||
|
||||
@Override
|
||||
public String queryMaster(){
|
||||
String msg = "";
|
||||
List<CxcJlQjglJlqjtz> queryDataList = cxcJlQjglJlqjtzMapper.queryJldData();
|
||||
if (queryDataList != null && queryDataList.size()>0){
|
||||
Long t1 = System.currentTimeMillis();
|
||||
Long t2 = System.currentTimeMillis();
|
||||
// saveBatch(queryDataList,1000);
|
||||
//使用该方法的时候需要在实体类里面设定 @TableId ,要不然会报错,jiang
|
||||
// cxcJlQjglJlqjtzMapper.mysqlInsertOrUpdateBath(queryDataList);
|
||||
saveOrUpdateBatch(queryDataList);
|
||||
msg = "新增局计量系统数据" + queryDataList.size() + "条。";
|
||||
System.out.println("新增局计量系统数据" + queryDataList.size() + "条。" );
|
||||
System.out.println("共耗时:" + (t2-t1) + "ms");
|
||||
}else{
|
||||
msg = "局计量系统暂时没有新的数据!";
|
||||
System.out.println("局计量系统暂时没有新的数据!");
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDw() {
|
||||
return baseMapper.getDw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getZc(String dw) {
|
||||
return baseMapper.getZc(dw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSbmc(String zc) {
|
||||
return baseMapper.getSbmc(zc);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
package org.gyk.modules.lssj.bjls.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gyk.common.annotation.AutoLog;
|
||||
import org.gyk.common.api.Result;
|
||||
import org.gyk.modules.lssj.bjls.entity.CxcSssjLssjBjlsjl;
|
||||
import org.gyk.modules.lssj.bjls.mapper.CxcSssjLssjBjlsjlMapper;
|
||||
import org.gyk.modules.lssj.bjls.service.ICxcSssjLssjBjlsjlService;
|
||||
import org.gyk.modules.sssj.controller.GykController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="报警历史记录")
|
||||
@RestController
|
||||
@RequestMapping("/bjls/cxcSssjLssjBjlsjl")
|
||||
@Slf4j
|
||||
public class CxcSssjLssjBjlsjlController extends GykController{
|
||||
@Autowired
|
||||
private ICxcSssjLssjBjlsjlService cxcSssjLssjBjlsjlService;
|
||||
@Autowired
|
||||
private CxcSssjLssjBjlsjlMapper cxcSssjLssjBjlsjlMapper;
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cxcSssjLssjBjlsjl
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "报警历史记录-添加")
|
||||
@ApiOperation(value="报警历史记录-添加", notes="报警历史记录-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody CxcSssjLssjBjlsjl cxcSssjLssjBjlsjl) {
|
||||
cxcSssjLssjBjlsjlService.save(cxcSssjLssjBjlsjl);
|
||||
return Result.ok("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cxcSssjLssjBjlsjl
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "报警历史记录-编辑")
|
||||
@ApiOperation(value="报警历史记录-编辑", notes="报警历史记录-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@RequestBody CxcSssjLssjBjlsjl cxcSssjLssjBjlsjl) {
|
||||
cxcSssjLssjBjlsjlService.updateById(cxcSssjLssjBjlsjl);
|
||||
return Result.ok("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "报警历史记录-通过id删除")
|
||||
@ApiOperation(value="报警历史记录-通过id删除", notes="报警历史记录-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
cxcSssjLssjBjlsjlService.removeById(id);
|
||||
return Result.ok("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "报警历史记录-批量删除")
|
||||
@ApiOperation(value="报警历史记录-批量删除", notes="报警历史记录-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.cxcSssjLssjBjlsjlService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.ok("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "报警历史记录-通过id查询")
|
||||
@ApiOperation(value="报警历史记录-通过id查询", notes="报警历史记录-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
CxcSssjLssjBjlsjl cxcSssjLssjBjlsjl = cxcSssjLssjBjlsjlService.getById(id);
|
||||
if(cxcSssjLssjBjlsjl==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.ok(cxcSssjLssjBjlsjl);
|
||||
}
|
||||
|
||||
//获取计量点报警历史数据 2023-08-28 Niujl
|
||||
@RequestMapping("/listBjByZc")
|
||||
public IPage listByZcAndJzh(@RequestParam(value = "pageNo") int pageNo, @RequestParam(value = "pageSize") int pageSize, @RequestParam(value = "zhanc") String zhanc, @RequestParam(name = "startTime", required = false) String startTime,
|
||||
@RequestParam(name = "endTime", required = false) String endTime) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
LambdaQueryWrapper<CxcSssjLssjBjlsjl> lmq = Wrappers.lambdaQuery();
|
||||
lmq.between(CxcSssjLssjBjlsjl::getCreateTime,startTime,endTime);
|
||||
lmq.eq(CxcSssjLssjBjlsjl::getBz,zhanc);
|
||||
lmq.orderByAsc(CxcSssjLssjBjlsjl::getCreateTime);
|
||||
|
||||
IPage<CxcSssjLssjBjlsjl> iPage = new Page<>(pageNo,pageSize);
|
||||
IPage<CxcSssjLssjBjlsjl> list = cxcSssjLssjBjlsjlMapper.selectPage(iPage,lmq);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
package org.gyk.modules.lssj.bjls.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public class CxcSssjLssjBjlsjl implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**ID*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private java.lang.String id;
|
||||
/**报警点ID*/
|
||||
@Excel(name = "报警点ID", width = 15)
|
||||
@ApiModelProperty(value = "报警点ID")
|
||||
private java.lang.String bjId;
|
||||
/**报警时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "报警时间")
|
||||
private LocalDateTime createTime;
|
||||
/**报警结束时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "报警时间")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
/**报警点名称*/
|
||||
@Excel(name = "报警点名称", width = 15)
|
||||
@ApiModelProperty(value = "报警点名称")
|
||||
private java.lang.String bjName;
|
||||
/**报警设定值*/
|
||||
@Excel(name = "报警设定值", width = 15)
|
||||
@ApiModelProperty(value = "报警设定值")
|
||||
private java.lang.String sdz;
|
||||
/**报警值*/
|
||||
@Excel(name = "报警值", width = 15)
|
||||
@ApiModelProperty(value = "报警值")
|
||||
private java.lang.String bjz;
|
||||
/**报警描述*/
|
||||
@Excel(name = "报警描述", width = 15)
|
||||
@ApiModelProperty(value = "报警描述")
|
||||
private java.lang.String reason;
|
||||
/**记录标志 a*/
|
||||
@Excel(name = "记录标志", width = 15)
|
||||
@ApiModelProperty(value = "记录标志")
|
||||
private java.lang.String jlbz;
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private java.lang.String bz;
|
||||
|
||||
private String zt;
|
||||
|
||||
private boolean saveflag;
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getBjId() {
|
||||
return bjId;
|
||||
}
|
||||
|
||||
public void setBjId(String bjId) {
|
||||
this.bjId = bjId;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(LocalDateTime createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getBjName() {
|
||||
return bjName;
|
||||
}
|
||||
|
||||
public void setBjName(String bjName) {
|
||||
this.bjName = bjName;
|
||||
}
|
||||
|
||||
public String getSdz() {
|
||||
return sdz;
|
||||
}
|
||||
|
||||
public void setSdz(String sdz) {
|
||||
this.sdz = sdz;
|
||||
}
|
||||
|
||||
public String getBjz() {
|
||||
return bjz;
|
||||
}
|
||||
|
||||
public void setBjz(String bjz) {
|
||||
this.bjz = bjz;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public String getBz() {
|
||||
return bz;
|
||||
}
|
||||
|
||||
public void setBz(String bz) {
|
||||
this.bz = bz;
|
||||
}
|
||||
//
|
||||
public String getJlbz() {
|
||||
return jlbz;
|
||||
}
|
||||
|
||||
public void setJlbz(String jlbz) { this.jlbz = jlbz; }
|
||||
|
||||
public LocalDateTime getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(LocalDateTime endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getZt() {
|
||||
return zt;
|
||||
}
|
||||
|
||||
public void setZt(String zt) {
|
||||
this.zt = zt;
|
||||
}
|
||||
|
||||
public boolean isSaveflag() {
|
||||
return saveflag;
|
||||
}
|
||||
|
||||
public void setSaveflag(boolean saveflag) {
|
||||
this.saveflag = saveflag;
|
||||
}
|
||||
}
|
18
src/main/java/org/gyk/modules/lssj/bjls/mapper/BjMapper.java
Normal file
18
src/main/java/org/gyk/modules/lssj/bjls/mapper/BjMapper.java
Normal file
@ -0,0 +1,18 @@
|
||||
package org.gyk.modules.lssj.bjls.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.gyk.modules.lssj.bjls.entity.CxcSssjLssjBjlsjl;
|
||||
|
||||
import java.util.List;
|
||||
@Mapper
|
||||
public interface BjMapper extends BaseMapper<CxcSssjLssjBjlsjl> {
|
||||
int insertBatch( List<CxcSssjLssjBjlsjl> vips);
|
||||
|
||||
//获取未处置的报警信息
|
||||
@Select(" select * from cxc_sssj_lssj_bjlsjl where bj_id = #{bjId} and zt = '1'")
|
||||
public List<CxcSssjLssjBjlsjl> getWczBjxx(@Param("bjId") String bjId);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package org.gyk.modules.lssj.bjls.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.gyk.modules.lssj.bjls.entity.CxcSssjLssjBjlsjl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface CxcSssjLssjBjlsjlMapper extends BaseMapper<CxcSssjLssjBjlsjl> {
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.gyk.modules.lssj.bjls.mapper.BjMapper">
|
||||
<insert id="insertBatch">
|
||||
insert into cxc_sssj_lssj_bjlsjl (id,bj_id,create_time,bj_name,sdz,bjz,reason,bz) values
|
||||
<foreach collection="list" item="dept" index="index" separator=",">
|
||||
(#{dept.id},#{dept.bj_id},#{dept.create_time}, #{dept.bj_name}, #{dept.sdz},#{dept.bjz}, #{dept.reason}, #{dept.bz})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.gyk.modules.lssj.bjls.mapper.CxcSssjLssjBjlsjlMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,17 @@
|
||||
package org.gyk.modules.lssj.bjls.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.gyk.modules.lssj.bjls.entity.CxcSssjLssjBjlsjl;
|
||||
import org.gyk.modules.sssj.entity.YasuojiJcxx;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICxcSssjLssjBjlsjlService extends IService<CxcSssjLssjBjlsjl> {
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package org.gyk.modules.lssj.bjls.service.impl;
|
||||
|
||||
import org.gyk.modules.lssj.bjls.entity.CxcSssjLssjBjlsjl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class BjlsService {
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.gyk.modules.lssj.bjls.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.gyk.modules.lssj.bjls.entity.CxcSssjLssjBjlsjl;
|
||||
import org.gyk.modules.lssj.bjls.mapper.CxcSssjLssjBjlsjlMapper;
|
||||
import org.gyk.modules.lssj.bjls.service.ICxcSssjLssjBjlsjlService;
|
||||
import org.gyk.modules.sz.jldxx.entity.CxcSssjSzJldxx;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
|
||||
public class CxcSssjLssjBjlsjlServiceImpl extends ServiceImpl<CxcSssjLssjBjlsjlMapper, CxcSssjLssjBjlsjl> implements ICxcSssjLssjBjlsjlService {
|
||||
|
||||
}
|
@ -0,0 +1,273 @@
|
||||
package org.gyk.modules.lssj.cxcsssjbjchuzhijilu.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
//import org.apache.commons.collections.map.HashedMap;
|
||||
import org.apache.poi.util.StringUtil;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.gyk.common.api.Result;
|
||||
import org.gyk.modules.lssj.cxcsssjbjchuzhijilu.entity.CxcSssjBjChuzhijilu;
|
||||
import org.gyk.modules.lssj.cxcsssjbjchuzhijilu.mapper.CxcSssjBjChuzhijiluMapper;
|
||||
import org.gyk.modules.lssj.cxcsssjbjchuzhijilu.service.ICxcSssjBjChuzhijiluService;
|
||||
import org.jeecgframework.poi.word.WordExportUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 实时数据报警处置记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-10-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="实时数据报警处置记录")
|
||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||
@RestController
|
||||
@RequestMapping("/cxcsssjbjchuzhijilu/cxcSssjBjChuzhijilu")
|
||||
@Slf4j
|
||||
public class CxcSssjBjChuzhijiluController {
|
||||
@Autowired
|
||||
private ICxcSssjBjChuzhijiluService cxcSssjBjChuzhijiluService;
|
||||
@Autowired
|
||||
private CxcSssjBjChuzhijiluMapper cxcSssjBjChuzhijiluMapper;
|
||||
@Value(value = "${muban}")
|
||||
private String uppath;
|
||||
|
||||
/**
|
||||
* 压缩机报警处置记录
|
||||
*
|
||||
* @param
|
||||
* @return Result<String>
|
||||
*/
|
||||
@RequestMapping("/BaoJinChuZhi")
|
||||
public Result<?> BaoJinChuZhi(@RequestBody JSONObject params ) {
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
LocalDateTime sbsj = LocalDateTime.now();
|
||||
|
||||
String userid = params.getString("userid");
|
||||
String zc = params.getString("zc");
|
||||
String jzh = params.getString("jzh");
|
||||
String bjmc = params.getString("bjmc");
|
||||
String bjsj = params.getString("bjsj");
|
||||
String bjms = params.getString("bjms");
|
||||
String yyfx = params.getString("yyfx");
|
||||
String czcs = params.getString("czcs");
|
||||
String czry = params.getString("czry");
|
||||
|
||||
List<String> userOrgCode = cxcSssjBjChuzhijiluService.queryOrgCode(userid);
|
||||
String orgcode = userOrgCode.get(0);
|
||||
// log.info("hi:"+userid+" name:"+czry+" time:"+bjsj+" "+jzh+" "+bjmc+" "+bjms+" "+yyfx+" "+czcs+" "+zc);
|
||||
|
||||
LocalDateTime bjdate = LocalDateTime.parse(bjsj, df);
|
||||
|
||||
CxcSssjBjChuzhijilu cxcSssjBjChuzhijilu = new CxcSssjBjChuzhijilu();
|
||||
cxcSssjBjChuzhijilu.setZhanchang(zc);
|
||||
cxcSssjBjChuzhijilu.setJizuhao(jzh);
|
||||
cxcSssjBjChuzhijilu.setBjName(bjmc);
|
||||
cxcSssjBjChuzhijilu.setBjTime(bjdate);
|
||||
cxcSssjBjChuzhijilu.setBjMs(bjms);
|
||||
cxcSssjBjChuzhijilu.setFenxiString(yyfx);
|
||||
cxcSssjBjChuzhijilu.setChuzhicuoshiString(czcs);
|
||||
cxcSssjBjChuzhijilu.setCreateBy(czry);
|
||||
cxcSssjBjChuzhijilu.setCreateTime(sbsj);
|
||||
cxcSssjBjChuzhijilu.setSysOrgCode(orgcode);
|
||||
|
||||
cxcSssjBjChuzhijiluService.save(cxcSssjBjChuzhijilu);
|
||||
|
||||
return Result.ok("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
public IPage<CxcSssjBjChuzhijilu> queryPageList(@RequestParam(value = "pageNo") int pageNo,@RequestParam(value = "pageSize") int pageSize,@RequestParam(value = "zhanc") String zhanc,@RequestParam(value = "jzh") String jzh,@RequestParam(name = "startTime", required = false) String startTime,
|
||||
@RequestParam(name = "endTime", required = false) String endTime) {
|
||||
LambdaQueryWrapper<CxcSssjBjChuzhijilu> lmq = Wrappers.lambdaQuery();
|
||||
lmq.between(CxcSssjBjChuzhijilu::getBjTime,startTime,endTime);
|
||||
lmq.eq(CxcSssjBjChuzhijilu::getZhanchang,zhanc);
|
||||
lmq.eq(CxcSssjBjChuzhijilu::getJizuhao,jzh);
|
||||
lmq.orderByAsc(CxcSssjBjChuzhijilu::getBjTime);
|
||||
|
||||
IPage<CxcSssjBjChuzhijilu> iPage = new Page<>(pageNo,pageSize);
|
||||
IPage<CxcSssjBjChuzhijilu> list = cxcSssjBjChuzhijiluMapper.selectPage(iPage,lmq);
|
||||
|
||||
|
||||
|
||||
// Map<String,String> mapjldxx = sssjTools.getJldnameByJldid(zhanc,jzh);
|
||||
//
|
||||
list.getRecords().forEach(item->{
|
||||
String[] arr = item.getBjName().split("\\*");
|
||||
item.setBjName(arr[1]);
|
||||
});
|
||||
|
||||
// log.info("total:"+list.getSize()+" "+list.getTotal());
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
//模板导出
|
||||
@GetMapping("/export")
|
||||
public void export(String id, HttpServletResponse response) throws Exception {
|
||||
//1.获取list
|
||||
LambdaQueryWrapper<CxcSssjBjChuzhijilu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CxcSssjBjChuzhijilu::getId,id);
|
||||
CxcSssjBjChuzhijilu bjChuzhiJilu = cxcSssjBjChuzhijiluService.getOne(queryWrapper);
|
||||
//2.获取map
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
//4.处理数据,防止导出word报错
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
map.put("zhanchang",bjChuzhiJilu.getZhanchang());
|
||||
map.put("jizuhao",bjChuzhiJilu.getJizuhao());
|
||||
String[] nmstr = bjChuzhiJilu.getBjName().split("\\*");
|
||||
map.put("bjname",nmstr[1]);
|
||||
map.put("bjtime",df.format(bjChuzhiJilu.getBjTime()));
|
||||
if (bjChuzhiJilu.getBjMs() == null || bjChuzhiJilu.getBjMs().isEmpty()) {
|
||||
map.put("bjms","");
|
||||
} else {
|
||||
map.put("bjms",bjChuzhiJilu.getBjMs());
|
||||
}
|
||||
|
||||
if (bjChuzhiJilu.getFenxiString() == null || bjChuzhiJilu.getFenxiString().isEmpty()) {
|
||||
map.put("yyfx","");
|
||||
} else {
|
||||
map.put("yyfx",bjChuzhiJilu.getFenxiString());
|
||||
}
|
||||
|
||||
if (bjChuzhiJilu.getChuzhicuoshiString() == null || bjChuzhiJilu.getChuzhicuoshiString().isEmpty()) {
|
||||
map.put("czcs","");
|
||||
} else {
|
||||
map.put("czcs",bjChuzhiJilu.getChuzhicuoshiString());
|
||||
}
|
||||
|
||||
map.put("czr",bjChuzhiJilu.getCreateBy());
|
||||
map.put("cztime",df.format(bjChuzhiJilu.getCreateTime()));
|
||||
|
||||
String path = uppath + File.separator;
|
||||
String fileName = path + "baojingchuzhi.docx";//这是模板路径1
|
||||
String fileName2 = path + "baojingchuzhiOut.docx";//这是导出路径
|
||||
|
||||
try {
|
||||
XWPFDocument doc = WordExportUtil.exportWord07(fileName, map);
|
||||
//5.输出word文件
|
||||
FileOutputStream fos = new FileOutputStream(fileName2);
|
||||
doc.write(fos);
|
||||
fos.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//2022-06-10 niujl
|
||||
// String fileName = uppath + "\\result.xlsx";
|
||||
try {
|
||||
//避免文件名中文乱码,将UTF8打散重组成ISO-8859-1编码方式
|
||||
fileName2 = new String(fileName2.getBytes("UTF8"), "ISO-8859-1");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//设置响应头的类型
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
//让浏览器下载文件,name是上述默认文件下载名
|
||||
response.addHeader("Content-Disposition", "attachment;filename=\"" + fileName2 + "\"");
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
//在service层中已经将数据存成了excel临时文件,并返回了临时文件的路径
|
||||
String downloadPath = fileName2;
|
||||
//根据临时文件的路径创建File对象,FileInputStream读取时需要使用
|
||||
File file = new File(downloadPath);
|
||||
//Niujl 2023.07.17
|
||||
long fileSize = new File(fileName2).length();
|
||||
response.addHeader("Content-Length", String.valueOf(fileSize));
|
||||
|
||||
try {
|
||||
//通过FileInputStream读临时文件,ServletOutputStream将临时文件写给浏览器
|
||||
inputStream = new FileInputStream(file);
|
||||
outputStream = response.getOutputStream();
|
||||
int len = -1;
|
||||
byte[] b = new byte[1024];
|
||||
while ((len = inputStream.read(b)) != -1) {
|
||||
outputStream.write(b);
|
||||
}
|
||||
//刷新
|
||||
outputStream.flush();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
//关闭输入输出流
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
if (outputStream != null) {
|
||||
outputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cxcSssjBjChuzhijilu
|
||||
* @return
|
||||
*/
|
||||
// @AutoLog(value = "实时数据报警处置记录-添加")
|
||||
// @ApiOperation(value="实时数据报警处置记录-添加", notes="实时数据报警处置记录-添加")
|
||||
// @PostMapping(value = "/add")
|
||||
// public Result<?> add(@RequestBody CxcSssjBjChuzhijilu cxcSssjBjChuzhijilu) {
|
||||
// cxcSssjBjChuzhijiluService.save(cxcSssjBjChuzhijilu);
|
||||
// return Result.ok("添加成功!");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cxcSssjBjChuzhijilu
|
||||
* @return
|
||||
// */
|
||||
// @AutoLog(value = "实时数据报警处置记录-编辑")
|
||||
// @ApiOperation(value="实时数据报警处置记录-编辑", notes="实时数据报警处置记录-编辑")
|
||||
// @PutMapping(value = "/edit")
|
||||
// public Result<?> edit(@RequestBody CxcSssjBjChuzhijilu cxcSssjBjChuzhijilu) {
|
||||
// cxcSssjBjChuzhijiluService.updateById(cxcSssjBjChuzhijilu);
|
||||
// return Result.ok("编辑成功!");
|
||||
// }
|
||||
//
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package org.gyk.modules.lssj.cxcsssjbjchuzhijilu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Description: 实时数据报警处置记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-10-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cxc_sssj_bj_chuzhijilu")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cxc_sssj_bj_chuzhijilu对象", description="实时数据报警处置记录")
|
||||
public class CxcSssjBjChuzhijilu implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private LocalDateTime createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private LocalDateTime updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**站场*/
|
||||
@Excel(name = "站场", width = 15)
|
||||
@ApiModelProperty(value = "站场")
|
||||
private java.lang.String zhanchang;
|
||||
/**机组号*/
|
||||
@Excel(name = "机组号", width = 15)
|
||||
@ApiModelProperty(value = "机组号")
|
||||
private java.lang.String jizuhao;
|
||||
/**报警名称*/
|
||||
@Excel(name = "报警名称", width = 15)
|
||||
@ApiModelProperty(value = "报警名称")
|
||||
private java.lang.String bjName;
|
||||
/**报警时间*/
|
||||
@Excel(name = "报警时间", width = 15, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "报警时间")
|
||||
private LocalDateTime bjTime;
|
||||
/**报警信息*/
|
||||
@Excel(name = "报警信息", width = 15)
|
||||
@ApiModelProperty(value = "报警信息")
|
||||
private java.lang.String bjMs;
|
||||
/**原因分析*/
|
||||
@Excel(name = "原因分析", width = 15)
|
||||
private transient java.lang.String fenxiString;
|
||||
|
||||
private byte[] fenxi;
|
||||
|
||||
public byte[] getFenxi(){
|
||||
if(fenxiString==null){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return fenxiString.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getFenxiString(){
|
||||
if(fenxi==null || fenxi.length==0){
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return new String(fenxi,"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/**处置措施*/
|
||||
@Excel(name = "处置措施", width = 15)
|
||||
private transient java.lang.String chuzhicuoshiString;
|
||||
|
||||
private byte[] chuzhicuoshi;
|
||||
|
||||
public byte[] getChuzhicuoshi(){
|
||||
if(chuzhicuoshiString==null){
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return chuzhicuoshiString.getBytes("UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getChuzhicuoshiString(){
|
||||
if(chuzhicuoshi==null || chuzhicuoshi.length==0){
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return new String(chuzhicuoshi,"UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package org.gyk.modules.lssj.cxcsssjbjchuzhijilu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.gyk.modules.lssj.cxcsssjbjchuzhijilu.entity.CxcSssjBjChuzhijilu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 实时数据报警处置记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-10-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface CxcSssjBjChuzhijiluMapper extends BaseMapper<CxcSssjBjChuzhijilu> {
|
||||
@Select("select org_code from sys_depart where id IN ( select dep_id from sys_user_depart where user_id = #{userid} )")
|
||||
public List<String> queryOrgCode (@Param("userid") String userid);
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.gyk.modules.lssj.cxcsssjbjchuzhijilu.mapper.CxcSssjBjChuzhijiluMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,17 @@
|
||||
package org.gyk.modules.lssj.cxcsssjbjchuzhijilu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.gyk.modules.lssj.cxcsssjbjchuzhijilu.entity.CxcSssjBjChuzhijilu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 实时数据报警处置记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-10-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICxcSssjBjChuzhijiluService extends IService<CxcSssjBjChuzhijilu> {
|
||||
//根据用户ID获取用户的depart_name and org_code
|
||||
public List<String> queryOrgCode(String userid);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.gyk.modules.lssj.cxcsssjbjchuzhijilu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.gyk.modules.lssj.cxcsssjbjchuzhijilu.entity.CxcSssjBjChuzhijilu;
|
||||
import org.gyk.modules.lssj.cxcsssjbjchuzhijilu.mapper.CxcSssjBjChuzhijiluMapper;
|
||||
import org.gyk.modules.lssj.cxcsssjbjchuzhijilu.service.ICxcSssjBjChuzhijiluService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 实时数据报警处置记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2023-10-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class CxcSssjBjChuzhijiluServiceImpl extends ServiceImpl<CxcSssjBjChuzhijiluMapper, CxcSssjBjChuzhijilu> implements ICxcSssjBjChuzhijiluService {
|
||||
@Override
|
||||
public List<String> queryOrgCode(String userid) {
|
||||
return baseMapper.queryOrgCode(userid);
|
||||
}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
package org.gyk.modules.lssj.jldls.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gyk.common.annotation.AutoLog;
|
||||
import org.gyk.common.api.Result;
|
||||
import org.gyk.modules.lssj.jldls.entity.CxcSssjLssjJldls;
|
||||
import org.gyk.modules.lssj.jldls.mapper.CxcSssjLssjJldlsMapper;
|
||||
import org.gyk.modules.lssj.jldls.service.ICxcSssjLssjJldlsService;
|
||||
import org.gyk.modules.sssj.controller.GykController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 计量点历史数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "计量点历史数据")
|
||||
@RestController
|
||||
@RequestMapping("/jldls/cxcSssjLssjJldls")
|
||||
@Slf4j
|
||||
public class CxcSssjLssjJldlsController extends GykController {
|
||||
@Autowired
|
||||
private ICxcSssjLssjJldlsService cxcSssjLssjJldlsService;
|
||||
@Autowired
|
||||
private CxcSssjLssjJldlsMapper cxcSssjLssjJldlsMapper;
|
||||
|
||||
// /**
|
||||
// * 添加
|
||||
// *
|
||||
// * @param cxcSssjLssjJldls
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "计量点历史数据-添加")
|
||||
// @ApiOperation(value="计量点历史数据-添加", notes="计量点历史数据-添加")
|
||||
// @PostMapping(value = "/add")
|
||||
// @DS("slave")
|
||||
// public Result<?> add(@RequestBody CxcSssjLssjJldls cxcSssjLssjJldls) {
|
||||
// cxcSssjLssjJldlsService.save(cxcSssjLssjJldls);
|
||||
// return Result.ok("添加成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 编辑
|
||||
// *
|
||||
// * @param cxcSssjLssjJldls
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "计量点历史数据-编辑")
|
||||
// @ApiOperation(value="计量点历史数据-编辑", notes="计量点历史数据-编辑")
|
||||
// @PutMapping(value = "/edit")
|
||||
// @DS("slave")
|
||||
// public Result<?> edit(@RequestBody CxcSssjLssjJldls cxcSssjLssjJldls) {
|
||||
// cxcSssjLssjJldlsService.updateById(cxcSssjLssjJldls);
|
||||
// return Result.ok("编辑成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 通过id删除
|
||||
// *
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "计量点历史数据-通过id删除")
|
||||
// @ApiOperation(value="计量点历史数据-通过id删除", notes="计量点历史数据-通过id删除")
|
||||
// @DeleteMapping(value = "/delete")
|
||||
// @DS("slave")
|
||||
// public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
// cxcSssjLssjJldlsService.removeById(id);
|
||||
// return Result.ok("删除成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 批量删除
|
||||
// *
|
||||
// * @param ids
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "计量点历史数据-批量删除")
|
||||
// @ApiOperation(value="计量点历史数据-批量删除", notes="计量点历史数据-批量删除")
|
||||
// @DeleteMapping(value = "/deleteBatch")
|
||||
// @DS("slave")
|
||||
// public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
// this.cxcSssjLssjJldlsService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
// return Result.ok("批量删除成功!");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "计量点历史数据-通过id查询")
|
||||
@ApiOperation(value = "计量点历史数据-通过id查询", notes = "计量点历史数据-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
@DS("slave")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
CxcSssjLssjJldls cxcSssjLssjJldls = cxcSssjLssjJldlsService.getById(id);
|
||||
if (cxcSssjLssjJldls == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.ok(cxcSssjLssjJldls);
|
||||
}
|
||||
|
||||
|
||||
@AutoLog(value = "计量点历史数据(5分钟)-查询")
|
||||
@ApiOperation(value = "计量点历史数据(5分钟)-查询", notes = "计量点历史数据(5分钟)-分页列表查询")
|
||||
@GetMapping(value = "/getLssjByJldId")
|
||||
@DS("slave")
|
||||
public Result<String> getLssjByJldId(@RequestParam(name = "jldId", required = false) String jldId,
|
||||
@RequestParam(name = "startTime") String startTime,
|
||||
@RequestParam(name = "endTime") String endTime) {
|
||||
Result<String> result = new Result<>();
|
||||
|
||||
if (startTime != null && startTime != "" && jldId !=null && jldId !="") {
|
||||
LambdaQueryWrapper<CxcSssjLssjJldls> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CxcSssjLssjJldls::getJldId, jldId);
|
||||
queryWrapper.ge(CxcSssjLssjJldls::getCreateTime, startTime);
|
||||
queryWrapper.le(CxcSssjLssjJldls::getCreateTime, endTime);
|
||||
List<CxcSssjLssjJldls> list = cxcSssjLssjJldlsService.list(queryWrapper);
|
||||
//对时间排序
|
||||
list.sort(Comparator.comparing(CxcSssjLssjJldls::getCreateTime));
|
||||
|
||||
result.setSuccess(true);
|
||||
result.setResult(JSONArray.toJSONString(list));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//获取计量点历史数据 2023-08-28 Niujl
|
||||
@RequestMapping("/listLssjByJldName")
|
||||
public IPage listByZcAndJzh(@RequestParam(value = "pageNo") int pageNo, @RequestParam(value = "pageSize") int pageSize, @RequestParam(value = "jldname") String jldname, @RequestParam(name = "startTime", required = false) String startTime,
|
||||
@RequestParam(name = "endTime", required = false) String endTime) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// log.info("name:"+jldname+" time:"+startTime);
|
||||
// long stime = System.currentTimeMillis();
|
||||
|
||||
LambdaQueryWrapper<CxcSssjLssjJldls> lmq = Wrappers.lambdaQuery();
|
||||
lmq.between(CxcSssjLssjJldls::getCreateTime,startTime,endTime);
|
||||
lmq.eq(CxcSssjLssjJldls::getJldName,jldname);
|
||||
lmq.orderByAsc(CxcSssjLssjJldls::getCreateTime);
|
||||
|
||||
IPage<CxcSssjLssjJldls> iPage = new Page<>(pageNo,pageSize);
|
||||
IPage<CxcSssjLssjJldls> list = cxcSssjLssjJldlsMapper.selectPage(iPage,lmq);
|
||||
|
||||
// long etime = System.currentTimeMillis();
|
||||
// log.info("执行时长:"+(etime-stime));
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
package org.gyk.modules.lssj.jldls.controller;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gyk.common.annotation.AutoLog;
|
||||
import org.gyk.common.api.Result;
|
||||
import org.gyk.modules.lssj.jldls.entity.CxcSssjLssjJldlsRsj;
|
||||
import org.gyk.modules.lssj.jldls.service.ICxcSssjLssjJldlsRsjService;
|
||||
import org.gyk.modules.sssj.controller.GykController;
|
||||
import org.gyk.modules.sssj.entity.CxcRsjQijing;
|
||||
import org.gyk.modules.sssj.entity.Rishuju;
|
||||
import org.gyk.modules.sssj.service.ICxcRsjQijingService;
|
||||
import org.gyk.modules.sssj.service.IRishujuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 计量点日数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-08-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="计量点日数据")
|
||||
@RestController
|
||||
@RequestMapping("/jldlsrsj/cxcSssjLssjJldlsRsj")
|
||||
@Slf4j
|
||||
public class CxcSssjLssjJldlsRsjController extends GykController{
|
||||
@Autowired
|
||||
private ICxcSssjLssjJldlsRsjService cxcSssjLssjJldlsRsjService;
|
||||
|
||||
@Autowired
|
||||
private IRishujuService rishujuService;
|
||||
@Autowired
|
||||
private ICxcRsjQijingService qijingService;
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param cxcSssjLssjJldlsRsj
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "计量点日数据-添加")
|
||||
@ApiOperation(value="计量点日数据-添加", notes="计量点日数据-添加")
|
||||
@PostMapping(value = "/add")
|
||||
|
||||
public Result<?> add(@RequestBody CxcSssjLssjJldlsRsj cxcSssjLssjJldlsRsj) {
|
||||
cxcSssjLssjJldlsRsjService.save(cxcSssjLssjJldlsRsj);
|
||||
return Result.ok("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param cxcSssjLssjJldlsRsj
|
||||
* @return
|
||||
*/
|
||||
// @AutoLog(value = "计量点日数据-编辑")
|
||||
// @ApiOperation(value="计量点日数据-编辑", notes="计量点日数据-编辑")
|
||||
// @PutMapping(value = "/edit")
|
||||
// public Result<?> edit(@RequestBody CxcSssjLssjJldlsRsj cxcSssjLssjJldlsRsj) {
|
||||
// cxcSssjLssjJldlsRsjService.updateById(cxcSssjLssjJldlsRsj);
|
||||
// return Result.ok("编辑成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 通过id删除
|
||||
// *
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "计量点日数据-通过id删除")
|
||||
// @ApiOperation(value="计量点日数据-通过id删除", notes="计量点日数据-通过id删除")
|
||||
// @DeleteMapping(value = "/delete")
|
||||
// public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
// cxcSssjLssjJldlsRsjService.removeById(id);
|
||||
// return Result.ok("删除成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 批量删除
|
||||
// *
|
||||
// * @param ids
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "计量点日数据-批量删除")
|
||||
// @ApiOperation(value="计量点日数据-批量删除", notes="计量点日数据-批量删除")
|
||||
// @DeleteMapping(value = "/deleteBatch")
|
||||
// public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
// this.cxcSssjLssjJldlsRsjService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
// return Result.ok("批量删除成功!");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "计量点日数据-通过id查询")
|
||||
@ApiOperation(value="计量点日数据-通过id查询", notes="计量点日数据-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
CxcSssjLssjJldlsRsj cxcSssjLssjJldlsRsj = cxcSssjLssjJldlsRsjService.getById(id);
|
||||
if(cxcSssjLssjJldlsRsj==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.ok(cxcSssjLssjJldlsRsj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过jldId查询年数据
|
||||
*
|
||||
* @param jh
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "计量点日数据-通过jldId查询")
|
||||
@ApiOperation(value="计量点日数据-通过jldId查询", notes="计量点日数据-通过jldId查询")
|
||||
@GetMapping(value = "/queryYByJldid")
|
||||
|
||||
public Result<?> queryYearByJldid(@RequestParam(name="jh",required=true) String jh) {
|
||||
|
||||
List<Map<String,Object>> RsjQjlist = qijingService.getYMDataByjh(jh);
|
||||
// for (Map<String,Object>map :RsjQjlist){
|
||||
//
|
||||
// System.out.println(map.get("qilMData"));
|
||||
// }
|
||||
|
||||
|
||||
// List<Map<String,Object>> Rsj = qijingService.getYMDataByjldIds(jh);
|
||||
// for (int i = 0 ; i<Rsj.size() ; i++){
|
||||
// String res = (String)Rsj.get(i).get("yData");
|
||||
// System.out.println(res);
|
||||
// }
|
||||
|
||||
// rishujuService.save((Rishuju) Rsj);
|
||||
|
||||
return Result.ok(RsjQjlist);
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package org.gyk.modules.lssj.jldls.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 计量点历史数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cxc_sssj_lssj_jldls")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cxc_sssj_lssj_jldls对象", description="计量点历史数据")
|
||||
public class CxcSssjLssjJldls implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**ID*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private String id;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**计量点ID*/
|
||||
@Excel(name = "计量点ID", width = 15)
|
||||
@ApiModelProperty(value = "计量点ID")
|
||||
private String jldId;
|
||||
/**站内ID*/
|
||||
@Excel(name = "站内ID", width = 15)
|
||||
@ApiModelProperty(value = "站内ID")
|
||||
private String jldNo;
|
||||
/**站场 */
|
||||
@Excel(name = "站场", width = 15)
|
||||
@ApiModelProperty(value = "站场")
|
||||
private String zhan;
|
||||
/**计量点名称*/
|
||||
@Excel(name = "计量点名称", width = 15)
|
||||
@ApiModelProperty(value = "计量点名称")
|
||||
private String jldName;
|
||||
/**管理区*/
|
||||
@Excel(name = "管理区", width = 15)
|
||||
@ApiModelProperty(value = "管理区")
|
||||
private String qu;
|
||||
/**温度*/
|
||||
@Excel(name = "温度", width = 15)
|
||||
@ApiModelProperty(value = "温度")
|
||||
private String wd;
|
||||
/**压力*/
|
||||
@Excel(name = "压力", width = 15)
|
||||
@ApiModelProperty(value = "压力")
|
||||
private String yl;
|
||||
/**压差*/
|
||||
@Excel(name = "压差", width = 15)
|
||||
@ApiModelProperty(value = "压差")
|
||||
private String yc;
|
||||
/**瞬时量*/
|
||||
@Excel(name = "瞬时量", width = 15)
|
||||
@ApiModelProperty(value = "瞬时量")
|
||||
private String ssll;
|
||||
/**今日量*/
|
||||
@Excel(name = "今日量", width = 15)
|
||||
@ApiModelProperty(value = "今日量")
|
||||
private String jrl;
|
||||
/**上月流量*/
|
||||
@Excel(name = "上月流量", width = 15)
|
||||
@ApiModelProperty(value = "上月流量")
|
||||
private String syll;
|
||||
/**本月流量*/
|
||||
@Excel(name = "本月流量", width = 15)
|
||||
@ApiModelProperty(value = "本月流量")
|
||||
private String byll;
|
||||
/**累积量*/
|
||||
@Excel(name = "累积量", width = 15)
|
||||
@ApiModelProperty(value = "累积量")
|
||||
private String zll;
|
||||
/**今日时间*/
|
||||
@Excel(name = "今日时间", width = 15)
|
||||
@ApiModelProperty(value = "今日时间")
|
||||
private String jrsj;
|
||||
/**仪表状态*/
|
||||
@Excel(name = "仪表状态", width = 15)
|
||||
@ApiModelProperty(value = "仪表状态")
|
||||
private String zt;
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String bz;
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package org.gyk.modules.lssj.jldls.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 计量点日数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-08-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cxc_sssj_lssj_jldls_rsj")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cxc_sssj_lssj_jldls_rsj对象", description="计量点日数据")
|
||||
public class CxcSssjLssjJldlsRsj implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
/**计量点ID*/
|
||||
@Excel(name = "计量点ID", width = 15)
|
||||
@ApiModelProperty(value = "计量点ID")
|
||||
private String jldId;
|
||||
/**温度*/
|
||||
@Excel(name = "温度", width = 15)
|
||||
@ApiModelProperty(value = "温度")
|
||||
private String wd;
|
||||
/**压力*/
|
||||
@Excel(name = "压力", width = 15)
|
||||
@ApiModelProperty(value = "压力")
|
||||
private String yl;
|
||||
/**压差*/
|
||||
@Excel(name = "压差", width = 15)
|
||||
@ApiModelProperty(value = "压差")
|
||||
private String yc;
|
||||
/**瞬时量*/
|
||||
@Excel(name = "瞬时量", width = 15)
|
||||
@ApiModelProperty(value = "瞬时量")
|
||||
private String ssll;
|
||||
/**气量*/
|
||||
@Excel(name = "气量", width = 15)
|
||||
@ApiModelProperty(value = "气量")
|
||||
private String jrl;
|
||||
/**上月流量*/
|
||||
@Excel(name = "上月流量", width = 15)
|
||||
@ApiModelProperty(value = "上月流量")
|
||||
private String syll;
|
||||
/**本月流量*/
|
||||
@Excel(name = "本月流量", width = 15)
|
||||
@ApiModelProperty(value = "本月流量")
|
||||
private String byll;
|
||||
/**累积量*/
|
||||
@Excel(name = "累积量", width = 15)
|
||||
@ApiModelProperty(value = "累积量")
|
||||
private String zll;
|
||||
/**今日时间*/
|
||||
@Excel(name = "今日时间", width = 15)
|
||||
@ApiModelProperty(value = "今日时间")
|
||||
private String jrsj;
|
||||
/**仪表状态*/
|
||||
@Excel(name = "仪表状态", width = 15)
|
||||
@ApiModelProperty(value = "仪表状态")
|
||||
private String zt;
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String bz;
|
||||
/**站场*/
|
||||
@Excel(name = "站场", width = 15)
|
||||
@ApiModelProperty(value = "站场")
|
||||
private String zhan;
|
||||
/**管理区*/
|
||||
@Excel(name = "管理区", width = 15)
|
||||
@ApiModelProperty(value = "管理区")
|
||||
private String qu;
|
||||
/**计量点名称*/
|
||||
@Excel(name = "计量点名称", width = 15)
|
||||
@ApiModelProperty(value = "计量点名称")
|
||||
private String jldName;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package org.gyk.modules.lssj.jldls.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.gyk.modules.lssj.jldls.entity.CxcSssjLssjJldls;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 计量点历史数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
@DS("slave")
|
||||
public interface CxcSssjLssjJldlsMapper extends BaseMapper<CxcSssjLssjJldls> {
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package org.gyk.modules.lssj.jldls.mapper;
|
||||
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.gyk.modules.lssj.jldls.entity.CxcSssjLssjJldlsRsj;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 计量点日数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-08-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface CxcSssjLssjJldlsRsjMapper extends BaseMapper<CxcSssjLssjJldlsRsj> {
|
||||
|
||||
|
||||
}
|
121
src/main/java/org/gyk/modules/lssj/jldls/mapper/JldlsMapper.java
Normal file
121
src/main/java/org/gyk/modules/lssj/jldls/mapper/JldlsMapper.java
Normal file
@ -0,0 +1,121 @@
|
||||
package org.gyk.modules.lssj.jldls.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.gyk.modules.lssj.bjls.entity.CxcSssjLssjBjlsjl;
|
||||
import org.gyk.modules.lssj.jldls.entity.CxcSssjLssjJldls;
|
||||
import org.gyk.modules.sssj.entity.JldData;
|
||||
import org.gyk.modules.sssj.entity.PianyuanZhan;
|
||||
import org.gyk.modules.sssj.entity.YasuojiBjSj;
|
||||
import org.gyk.modules.sssj.entity.YasuojiSj;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 计量点历史数据-批量存储
|
||||
* @Author: liao
|
||||
* @Date: 2021-04-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface JldlsMapper extends BaseMapper<CxcSssjLssjJldls> {
|
||||
//10.75.166.13:3306/jeecg-boot-cxc
|
||||
int insertBatch( List<CxcSssjLssjJldls> vips);
|
||||
|
||||
@Insert("<script>" +
|
||||
"insert into cxc_sssj_pianyuan (id,jldname,rq,wd,yali,bkss,gkss,bkzl,gkzl,zrbklj,jrlj)" +
|
||||
" values" +
|
||||
" <foreach collection='list' item='jldls' separator=','>" +
|
||||
" (#{jldls.id},#{jldls.jldname}, #{jldls.rq}, #{jldls.wd},#{jldls.yali}, #{jldls.bkss}, #{jldls.gkss}, #{jldls.bkzl},#{jldls.gkzl}, #{jldls.zrbklj}, #{jldls.jrlj})" +
|
||||
" </foreach>" +
|
||||
"</script>"
|
||||
)
|
||||
@DS("slave")
|
||||
void insertPianyuanMaster(@Param("list") List<PianyuanZhan> list);
|
||||
|
||||
//获取偏远站场指定日期8点数据
|
||||
@Select(" SELECT * FROM `cxc_sssj_pianyuan` WHERE rq>= #{startTime} and DATE_FORMAT(rq,'%H:%i')='08:00' and jldname in ('白九来气','东明站来气') ")
|
||||
@DS("slave")
|
||||
public List<PianyuanZhan> listPiany(@Param("startTime") String startTime);
|
||||
|
||||
//修改偏远站场指定日期8点数据
|
||||
@Select(" insert into cxc_sssj_pianyuan(id,jldname,rq,bkzl) values (#{id},#{jldname},#{rq}, #{bkzl})")
|
||||
@DS("slave")
|
||||
public List<PianyuanZhan> editPianyuan8(@Param("id") String id,@Param("jldname") String jldname,@Param("rq") String rq,@Param("bkzl") String bkzl);
|
||||
|
||||
|
||||
@Insert("<script>" +
|
||||
"insert into cxc_sssj_lssj_jldls (id,create_time,jld_id,jld_no,wd,yl,yc,ssll,jrl,syll,byll,zll,jrsj,zt,`zhan`,`jld_name`)" +
|
||||
" values" +
|
||||
" <foreach collection='list' item='jldls' separator=','>" +
|
||||
" (#{jldls.id},#{jldls.createTime}, #{jldls.jldId}, #{jldls.jldNo},#{jldls.wd}, #{jldls.yl}, #{jldls.yc},#{jldls.ssll}, #{jldls.jrl}, #{jldls.syll}, #{jldls.byll}, #{jldls.zll}, #{jldls.jrsj}, #{jldls.zt}, #{jldls.zhan}, #{jldls.jldName})" +
|
||||
" </foreach>" +
|
||||
"</script>"
|
||||
)
|
||||
@DS("three")
|
||||
void insertBatchMaster(@Param("list") List<CxcSssjLssjJldls> list);
|
||||
|
||||
//10.75.166.13:3306/jeecg-boot-jldls
|
||||
@Insert("<script>" +
|
||||
"insert into cxc_sssj_lssj_jldls (id,create_time,jld_id,jld_no,wd,yl,yc,ssll,jrl,syll,byll,zll,jrsj,zt,`zhan`,`jld_name`)" +
|
||||
" values" +
|
||||
" <foreach collection='list' item='jldls' separator=','>" +
|
||||
" (#{jldls.id},#{jldls.createTime}, #{jldls.jldId}, #{jldls.jldNo},#{jldls.wd}, #{jldls.yl}, #{jldls.yc},#{jldls.ssll}, #{jldls.jrl}, #{jldls.syll}, #{jldls.byll}, #{jldls.zll}, #{jldls.jrsj}, #{jldls.zt}, #{jldls.zhan}, #{jldls.jldName})" +
|
||||
" </foreach>" +
|
||||
"</script>"
|
||||
)
|
||||
@DS("slave")
|
||||
void insertBatchSlave(@Param("list") List<CxcSssjLssjJldls> list);
|
||||
|
||||
@Insert("<script>" +
|
||||
"insert into cxc_sssj_yasuoji_bjls (`id`,`bj_id`,`begin_time`,`end_time`,`canshu_zhi`,`bj_ms`,`stationname`,`jizuhao`,`zt`)" +
|
||||
" values" +
|
||||
" <foreach collection='list' item='jldls' separator=','>" +
|
||||
" (#{jldls.id},#{jldls.bjId}, #{jldls.beginTime}, #{jldls.endTime},#{jldls.canshuZhi}, #{jldls.bjMs},#{jldls.stationname}, #{jldls.jizuhao}, #{jldls.zt})" +
|
||||
" </foreach>" +
|
||||
"</script>"
|
||||
)
|
||||
@DS("slave")
|
||||
void YasuojiBj(@Param("list") List<YasuojiBjSj> list);
|
||||
|
||||
@Insert("<script>" +
|
||||
"insert into cxc_sssj_yasuoji (`id`,`depart_name`,`station_name`,`jizu_hao`,`ysjxh`,`rq`,`shuju`)" +
|
||||
" values" +
|
||||
" <foreach collection='list' item='jldls' separator=','>" +
|
||||
" (#{jldls.id},#{jldls.departName}, #{jldls.stationName}, #{jldls.jizuHao},#{jldls.ysjxh}, #{jldls.rq}, #{jldls.shuju})" +
|
||||
" </foreach>" +
|
||||
"</script>"
|
||||
)
|
||||
@DS("slave")
|
||||
void YasuojiSssj(@Param("list") List<YasuojiSj> list);
|
||||
|
||||
// @Select(" SELECT * FROM `cxc_sssj_yasuoji_bjls` WHERE end_time>= date_sub(now(),INTERVAL #{sc} HOUR) ORDER BY end_time desc")
|
||||
@Select(" SELECT * FROM `cxc_sssj_yasuoji_bjls` where zt='1' ORDER BY end_time desc")
|
||||
@DS("slave")
|
||||
public List<YasuojiBjSj> getYsjBj();
|
||||
|
||||
//获取压缩机报警历史数据
|
||||
@Select(" SELECT * FROM `cxc_sssj_yasuoji_bjls` WHERE begin_time BETWEEN #{startTime} AND #{endTime} ORDER BY begin_time")
|
||||
@DS("slave")
|
||||
public List<YasuojiBjSj> getYsjBjsj(@Param("startTime") String startTime,@Param("endTime") String endTime);
|
||||
|
||||
//获取压缩机历史数据的表头
|
||||
@Select(" SELECT station_name,jizu_hao,rq,shuju FROM `cxc_sssj_yasuoji` WHERE station_name=#{zc} and jizu_hao=#{jzh} limit 1")
|
||||
@DS("slave")
|
||||
public List<YasuojiSj> getYsjLsBt(@Param("zc") String zc,@Param("jzh") String jzh);
|
||||
|
||||
//获取压缩机历史数据
|
||||
@Select(" SELECT station_name,jizu_hao,rq,shuju FROM `cxc_sssj_yasuoji` WHERE rq BETWEEN #{startTime} AND #{endTime} and station_name=#{zc} and jizu_hao=#{jzh} order by rq")
|
||||
@DS("slave")
|
||||
public List<YasuojiSj> getYsjLssj(@Param("zc") String zc,@Param("jzh") String jzh,@Param("startTime") String startTime,@Param("endTime") String endTime);
|
||||
|
||||
// @Select(" SELECT * FROM `cxc_sssj_lssj_bjlsjl` WHERE end_time>= date_sub(now(),INTERVAL #{sc} HOUR) and jlbz=#{lb} ORDER BY end_time desc")
|
||||
//查询报警历史表中未处置的条目
|
||||
// 添加了一个条件 zt不为0 jiang.20240321
|
||||
@Select(" SELECT * FROM `cxc_sssj_lssj_bjlsjl` WHERE jlbz=#{lb} and zt !='0' ORDER BY end_time desc limit #{sc}")
|
||||
public List<CxcSssjLssjBjlsjl> getTrqBjxx(@Param("sc") int sc,@Param("lb") String lb);
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.gyk.modules.lssj.jldls.mapper.CxcSssjLssjJldlsMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.gyk.modules.lssj.jldls.mapper.CxcSssjLssjJldlsRsjMapper">
|
||||
|
||||
|
||||
</mapper>
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.gyk.modules.lssj.jldls.mapper.JldlsMapper">
|
||||
<insert id="insertBatch">
|
||||
insert into cxc_sssj_lssj_jldls (id,create_time,jld_id,jld_No,wd,yl,yc,ssll,jrl,syll,byll,zll,jrsj,zt,bz) values
|
||||
<foreach collection="list" item="jldls" index="index" separator=",">
|
||||
(#{jldls.id},#{jldls.create_time}, #{jldls.jld_id}, #{jldls.jld_No},#{jldls.wd}, #{jldls.yl}, #{jldls.yc},#{jldls.ssll}, #{jldls.jrl}, #{jldls.syll}, #{jldls.byll}, #{jldls.zll}, #{jldls.jrsj}, #{jldls.zt}, #{jldls.bz})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
@ -0,0 +1,18 @@
|
||||
package org.gyk.modules.lssj.jldls.service;
|
||||
|
||||
import org.gyk.modules.lssj.jldls.entity.CxcSssjLssjJldlsRsj;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 计量点日数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-08-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ICxcSssjLssjJldlsRsjService extends IService<CxcSssjLssjJldlsRsj> {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package org.gyk.modules.lssj.jldls.service;
|
||||
|
||||
import org.gyk.modules.lssj.jldls.entity.CxcSssjLssjJldls;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description: 计量点历史数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
||||
public interface ICxcSssjLssjJldlsService extends IService<CxcSssjLssjJldls> {
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package org.gyk.modules.lssj.jldls.service.impl;
|
||||
|
||||
import org.gyk.modules.lssj.jldls.entity.CxcSssjLssjJldlsRsj;
|
||||
import org.gyk.modules.lssj.jldls.mapper.CxcSssjLssjJldlsRsjMapper;
|
||||
import org.gyk.modules.lssj.jldls.service.ICxcSssjLssjJldlsRsjService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 计量点日数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-08-16
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
|
||||
public class CxcSssjLssjJldlsRsjServiceImpl extends ServiceImpl<CxcSssjLssjJldlsRsjMapper, CxcSssjLssjJldlsRsj> implements ICxcSssjLssjJldlsRsjService {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.gyk.modules.lssj.jldls.service.impl;
|
||||
|
||||
import org.gyk.modules.lssj.jldls.entity.CxcSssjLssjJldls;
|
||||
import org.gyk.modules.lssj.jldls.mapper.CxcSssjLssjJldlsMapper;
|
||||
import org.gyk.modules.lssj.jldls.mapper.JldlsMapper;
|
||||
import org.gyk.modules.lssj.jldls.service.ICxcSssjLssjJldlsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 计量点历史数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-30
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
|
||||
public class CxcSssjLssjJldlsServiceImpl extends ServiceImpl<CxcSssjLssjJldlsMapper, CxcSssjLssjJldls> implements ICxcSssjLssjJldlsService {
|
||||
//
|
||||
// @Override
|
||||
// public int insertBatchSlave(List<CxcSssjLssjJldls> list) {
|
||||
// return
|
||||
// }
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package org.gyk.modules.lssj.ngzxsj.controller;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gyk.modules.sssj.controller.GykController;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="报警历史记录")
|
||||
@RestController
|
||||
@RequestMapping("/Ngzxlssj")
|
||||
@Slf4j
|
||||
public class ngzxLssjController extends GykController{
|
||||
|
||||
|
||||
// /**
|
||||
// * 添加
|
||||
// *
|
||||
// * @param cxcSssjYasuojiBjls
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-添加")
|
||||
// @ApiOperation(value="报警历史记录-添加", notes="报警历史记录-添加")
|
||||
// @PostMapping(value = "/add")
|
||||
// public Result<?> add(@RequestBody CxcSssjYasuojiBjls cxcSssjYasuojiBjls) {
|
||||
// yasuojiBaojLssjService.save(cxcSssjYasuojiBjls);
|
||||
// return Result.ok("添加成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 编辑
|
||||
// *
|
||||
// * @param cxcSssjYasuojiBjls
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-编辑")
|
||||
// @ApiOperation(value="报警历史记录-编辑", notes="报警历史记录-编辑")
|
||||
// @PutMapping(value = "/edit")
|
||||
// public Result<?> edit(@RequestBody CxcSssjYasuojiBjls cxcSssjYasuojiBjls) {
|
||||
// yasuojiBaojLssjService.updateById(cxcSssjYasuojiBjls);
|
||||
// return Result.ok("编辑成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 通过id删除
|
||||
// *
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-通过id删除")
|
||||
// @ApiOperation(value="报警历史记录-通过id删除", notes="报警历史记录-通过id删除")
|
||||
// @DeleteMapping(value = "/delete")
|
||||
// public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
// yasuojiBaojLssjService.removeById(id);
|
||||
// return Result.ok("删除成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 批量删除
|
||||
// *
|
||||
// * @param ids
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-批量删除")
|
||||
// @ApiOperation(value="报警历史记录-批量删除", notes="报警历史记录-批量删除")
|
||||
// @DeleteMapping(value = "/deleteBatch")
|
||||
// public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
// this.yasuojiBaojLssjService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
// return Result.ok("批量删除成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 通过id查询
|
||||
// *
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-通过id查询")
|
||||
// @ApiOperation(value="报警历史记录-通过id查询", notes="报警历史记录-通过id查询")
|
||||
// @GetMapping(value = "/queryById")
|
||||
// public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
// CxcSssjYasuojiBjls cxcSssjYasuojiBjls = yasuojiBaojLssjService.getById(id);
|
||||
// if(cxcSssjYasuojiBjls ==null) {
|
||||
// return Result.error("未找到对应数据");
|
||||
// }
|
||||
// return Result.ok(cxcSssjYasuojiBjls);
|
||||
// }
|
||||
|
||||
// @RequestMapping("/list")
|
||||
// public IPage<CxcSssjYasuojiBjls> list() {
|
||||
// LambdaQueryWrapper<CxcSssjYasuojiBjls> lmq = Wrappers.lambdaQuery();
|
||||
// lmq.between(CxcSssjYasuojiBjls::getBeginTime,"2023-08-21","2023-08-26");
|
||||
// lmq.eq(CxcSssjYasuojiBjls::getStationname,"文二联增压站");
|
||||
// lmq.eq(CxcSssjYasuojiBjls::getJizuhao,"一号机组");
|
||||
//
|
||||
// IPage<CxcSssjYasuojiBjls> iPage = new Page<>(2,4);
|
||||
// IPage<CxcSssjYasuojiBjls> list = yasuojBaojLssjMapper.selectPage(iPage,lmq);
|
||||
//
|
||||
// Map<String,String> mapjldxx = sssjTools.getJldnameByJldid("文二联增压站","一号机组");
|
||||
//
|
||||
// list.getRecords().forEach(item->{
|
||||
// item.setBjId(mapjldxx.get(item.getBjId()));
|
||||
// });
|
||||
//
|
||||
// log.info("total:"+list.getSize()+" "+list.getTotal());
|
||||
//
|
||||
// return list;
|
||||
// }
|
||||
|
||||
// @RequestMapping("/listByZcAndJzh")
|
||||
// public IPage<CxcSssjYasuojiBjls> listByZcAndJzh(@RequestParam(value = "pageNo") int pageNo,@RequestParam(value = "pageSize") int pageSize,@RequestParam(value = "zhanc") String zhanc,@RequestParam(value = "jzh") String jzh,@RequestParam(name = "startTime", required = false) String startTime,
|
||||
// @RequestParam(name = "endTime", required = false) String endTime) {
|
||||
// LambdaQueryWrapper<CxcSssjYasuojiBjls> lmq = Wrappers.lambdaQuery();
|
||||
// lmq.between(CxcSssjYasuojiBjls::getBeginTime,startTime,endTime);
|
||||
// lmq.eq(CxcSssjYasuojiBjls::getStationname,zhanc);
|
||||
// lmq.eq(CxcSssjYasuojiBjls::getJizuhao,jzh);
|
||||
// lmq.orderByAsc(CxcSssjYasuojiBjls::getBeginTime);
|
||||
//
|
||||
// IPage<CxcSssjYasuojiBjls> iPage = new Page<>(pageNo,pageSize);
|
||||
// IPage<CxcSssjYasuojiBjls> list = yasuojBaojLssjMapper.selectPage(iPage,lmq);
|
||||
//
|
||||
// Map<String,String> mapjldxx = sssjTools.getJldnameByJldid(zhanc,jzh);
|
||||
//
|
||||
// list.getRecords().forEach(item->{
|
||||
// item.setBjId(mapjldxx.get(item.getBjId()));
|
||||
// });
|
||||
//
|
||||
// log.info("total:"+list.getSize()+" "+list.getTotal());
|
||||
//
|
||||
// return list;
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package org.gyk.modules.lssj.ngzxsj.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.gyk.modules.sssj.entity.NgSssj;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
@DS("slave")
|
||||
public interface ngzxLssjMapper extends BaseMapper<NgSssj> {
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.gyk.modules.lssj.ngzxsj.mapper.ngzxLssjMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
package org.gyk.modules.lssj.ngzxsj.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.gyk.modules.sssj.entity.NgSssj;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IngzxLssjService extends IService<NgSssj> {
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package org.gyk.modules.lssj.ngzxsj.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.gyk.modules.sssj.entity.NgSssj;
|
||||
import org.gyk.modules.lssj.ngzxsj.mapper.ngzxLssjMapper;
|
||||
import org.gyk.modules.lssj.ngzxsj.service.IngzxLssjService;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
|
||||
public class ngzxLssjServiceImpl extends ServiceImpl<ngzxLssjMapper, NgSssj> implements IngzxLssjService {
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package org.gyk.modules.lssj.scls.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 输差历史数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-04-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cxc_sssj_lssj_scls")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cxc_sssj_lssj_scls对象", description="输差历史数据")
|
||||
public class CxcSssjLssjScls implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**ID*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private java.lang.String id;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**输差编号*/
|
||||
@Excel(name = "输差编号", width = 15)
|
||||
@ApiModelProperty(value = "输差编号")
|
||||
private java.lang.String scId;
|
||||
/**输差名称*/
|
||||
@Excel(name = "输差名称", width = 15)
|
||||
@ApiModelProperty(value = "输差名称")
|
||||
private java.lang.String scName;
|
||||
/**实时输差*/
|
||||
@Excel(name = "实时输差", width = 15)
|
||||
@ApiModelProperty(value = "实时输差")
|
||||
private java.lang.String sssc;
|
||||
/**输差类别*/
|
||||
@Excel(name = "输差类别", width = 15)
|
||||
@ApiModelProperty(value = "输差类别")
|
||||
private java.lang.String scType;
|
||||
/**进气计量点ID*/
|
||||
@Excel(name = "进气计量点ID", width = 15)
|
||||
@ApiModelProperty(value = "进气计量点ID")
|
||||
private java.lang.String inPoints;
|
||||
/**出气计量点ID*/
|
||||
@Excel(name = "出气计量点ID", width = 15)
|
||||
@ApiModelProperty(value = "出气计量点ID")
|
||||
private java.lang.String outPoints;
|
||||
/**管理区ID*/
|
||||
@Excel(name = "管理区ID", width = 15)
|
||||
@ApiModelProperty(value = "管理区ID")
|
||||
private java.lang.String departId;
|
||||
/**站场ID*/
|
||||
@Excel(name = "站场ID", width = 15)
|
||||
@ApiModelProperty(value = "站场ID")
|
||||
private java.lang.String stationId;
|
||||
/**今日进气总量*/
|
||||
@Excel(name = "今日进气总量", width = 15)
|
||||
@ApiModelProperty(value = "今日进气总量")
|
||||
private java.lang.String jrlIn;
|
||||
/**今日出气总量*/
|
||||
@Excel(name = "今日出气总量", width = 15)
|
||||
@ApiModelProperty(value = "今日出气总量")
|
||||
private java.lang.String jrlOut;
|
||||
/**今日量输差*/
|
||||
@Excel(name = "今日量输差", width = 15)
|
||||
@ApiModelProperty(value = "今日量输差")
|
||||
private java.lang.String jrlsc;
|
||||
/**今日输差百分数*/
|
||||
@Excel(name = "今日输差百分数", width = 15)
|
||||
@ApiModelProperty(value = "今日输差百分数")
|
||||
private java.lang.String jrlscbfs;
|
||||
/**实时进气量*/
|
||||
@Excel(name = "实时进气量", width = 15)
|
||||
@ApiModelProperty(value = "实时进气量")
|
||||
private java.lang.String ssIn;
|
||||
/**实时出气量*/
|
||||
@Excel(name = "实时出气量", width = 15)
|
||||
@ApiModelProperty(value = "实时出气量")
|
||||
private java.lang.String ssOut;
|
||||
/**实时输差百分数*/
|
||||
@Excel(name = "实时输差百分数", width = 15)
|
||||
@ApiModelProperty(value = "实时输差百分数")
|
||||
private java.lang.String ssscbfs;
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private java.lang.String bz;
|
||||
}
|
||||
|
@ -0,0 +1,89 @@
|
||||
package org.gyk.modules.lssj.scls.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 输差历史数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-04-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cxc_sssj_scls")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cxc_sssj_scls对象", description="输差历史数据")
|
||||
public class CxcSssjScls implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**ID*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private String id;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**输差编号*/
|
||||
@Excel(name = "输差编号", width = 15)
|
||||
@ApiModelProperty(value = "输差编号")
|
||||
private String scId;
|
||||
/**输差名称*/
|
||||
@Excel(name = "输差名称", width = 15)
|
||||
@ApiModelProperty(value = "输差名称")
|
||||
private String scName;
|
||||
/**实时输差*/
|
||||
@Excel(name = "实时输差", width = 15)
|
||||
@ApiModelProperty(value = "实时输差")
|
||||
private java.lang.Double sssc;
|
||||
/**输差类别*/
|
||||
@Excel(name = "输差类别", width = 15)
|
||||
@ApiModelProperty(value = "输差类别")
|
||||
private String scType;
|
||||
/**站场ID*/
|
||||
@Excel(name = "站场ID", width = 15)
|
||||
@ApiModelProperty(value = "站场ID")
|
||||
private String stationId;
|
||||
/**今日进气总量*/
|
||||
@Excel(name = "今日进气总量", width = 15)
|
||||
@ApiModelProperty(value = "今日进气总量")
|
||||
private java.lang.Double jrlIn;
|
||||
/**今日出气总量*/
|
||||
@Excel(name = "今日出气总量", width = 15)
|
||||
@ApiModelProperty(value = "今日出气总量")
|
||||
private java.lang.Double jrlOut;
|
||||
/**今日量输差*/
|
||||
@Excel(name = "今日量输差", width = 15)
|
||||
@ApiModelProperty(value = "今日量输差")
|
||||
private java.lang.Double jrlsc;
|
||||
/**今日输差百分数*/
|
||||
@Excel(name = "今日输差百分数", width = 15)
|
||||
@ApiModelProperty(value = "今日输差百分数")
|
||||
private java.lang.Double jrlscbfs;
|
||||
/**实时进气量*/
|
||||
@Excel(name = "实时进气量", width = 15)
|
||||
@ApiModelProperty(value = "实时进气量")
|
||||
private java.lang.Double ssIn;
|
||||
/**实时出气量*/
|
||||
@Excel(name = "实时出气量", width = 15)
|
||||
@ApiModelProperty(value = "实时出气量")
|
||||
private java.lang.Double ssOut;
|
||||
/**实时输差百分数*/
|
||||
@Excel(name = "实时输差百分数", width = 15)
|
||||
@ApiModelProperty(value = "实时输差百分数")
|
||||
private java.lang.Double ssscbfs;
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
package org.gyk.modules.lssj.scls.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.gyk.modules.lssj.scls.entity.CxcSssjLssjScls;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SclsMapper extends BaseMapper<CxcSssjLssjScls> {
|
||||
int insertBatch( List<CxcSssjLssjScls> vips);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.gyk.modules.lssj.scls.mapper.SclsMapper">
|
||||
<insert id="insertBatch">
|
||||
insert into cxc_sssj_lssj_jscls (id,create_time,sc_id,sc_name,sssc,sc_type,in_points,out_points,depart_id,station_id,jrl_in,jrl_out,jrlsc,jrlscbfs,ss_in,ss_out,ssscbfs,bz) values
|
||||
<foreach collection="list" item="scls" index="index" separator=",">
|
||||
(#{scls.id},#{scls.create_time}, #{scls.sc_id}, #{scls.sc_name},#{scls.sssc}, #{scls.sc_type}, #{scls.in_points},#{scls.out_points}, #{scls.depart_id}, #{scls.station_id}, #{scls.jrl_in}, #{scls.jrl_out}, #{scls.jrsj}, #{scls.jrlsc}, #{scls.jrlscbfs}, #{scls.ss_in}, #{scls.ss_out}, #{scls.jrlscbfs}, #{scls.ssscbfs}, #{scls.bz})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,192 @@
|
||||
package org.gyk.modules.lssj.yasuojishuju.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.util.StringUtil;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.gyk.common.api.Result;
|
||||
import org.gyk.modules.lssj.yasuojishuju.entity.CxcSssjYasuojiBjls;
|
||||
import org.gyk.modules.lssj.yasuojishuju.mapper.YasuojBaojLssjMapper;
|
||||
import org.gyk.modules.lssj.yasuojishuju.service.IYasuojiBaojLssjService;
|
||||
import org.gyk.modules.sssj.controller.GykController;
|
||||
import org.gyk.modules.sssj.util.sssjTools;
|
||||
import org.gyk.modules.websocket.webSocket;
|
||||
import org.jeecgframework.poi.word.WordExportUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="报警历史记录")
|
||||
@CrossOrigin(origins = "*", maxAge = 3600)
|
||||
@RestController
|
||||
@RequestMapping("/YasuojBjlssj")
|
||||
@Slf4j
|
||||
public class YasuojiBaojLssjController extends GykController{
|
||||
@Autowired
|
||||
private IYasuojiBaojLssjService yasuojiBaojLssjService;
|
||||
@Autowired
|
||||
private YasuojBaojLssjMapper yasuojBaojLssjMapper;
|
||||
@Resource
|
||||
private webSocket webSocket;
|
||||
|
||||
// /**
|
||||
// * 添加
|
||||
// *
|
||||
// * @param cxcSssjYasuojiBjls
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-添加")
|
||||
// @ApiOperation(value="报警历史记录-添加", notes="报警历史记录-添加")
|
||||
// @PostMapping(value = "/add")
|
||||
// public Result<?> add(@RequestBody CxcSssjYasuojiBjls cxcSssjYasuojiBjls) {
|
||||
// yasuojiBaojLssjService.save(cxcSssjYasuojiBjls);
|
||||
// return Result.ok("添加成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 编辑
|
||||
// *
|
||||
// * @param cxcSssjYasuojiBjls
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-编辑")
|
||||
// @ApiOperation(value="报警历史记录-编辑", notes="报警历史记录-编辑")
|
||||
// @PutMapping(value = "/edit")
|
||||
// public Result<?> edit(@RequestBody CxcSssjYasuojiBjls cxcSssjYasuojiBjls) {
|
||||
// yasuojiBaojLssjService.updateById(cxcSssjYasuojiBjls);
|
||||
// return Result.ok("编辑成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 通过id删除
|
||||
// *
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-通过id删除")
|
||||
// @ApiOperation(value="报警历史记录-通过id删除", notes="报警历史记录-通过id删除")
|
||||
// @DeleteMapping(value = "/delete")
|
||||
// public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
// yasuojiBaojLssjService.removeById(id);
|
||||
// return Result.ok("删除成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 批量删除
|
||||
// *
|
||||
// * @param ids
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-批量删除")
|
||||
// @ApiOperation(value="报警历史记录-批量删除", notes="报警历史记录-批量删除")
|
||||
// @DeleteMapping(value = "/deleteBatch")
|
||||
// public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
// this.yasuojiBaojLssjService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
// return Result.ok("批量删除成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 通过id查询
|
||||
// *
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-通过id查询")
|
||||
// @ApiOperation(value="报警历史记录-通过id查询", notes="报警历史记录-通过id查询")
|
||||
// @GetMapping(value = "/queryById")
|
||||
// public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
// CxcSssjYasuojiBjls cxcSssjYasuojiBjls = yasuojiBaojLssjService.getById(id);
|
||||
// if(cxcSssjYasuojiBjls ==null) {
|
||||
// return Result.error("未找到对应数据");
|
||||
// }
|
||||
// return Result.ok(cxcSssjYasuojiBjls);
|
||||
// }
|
||||
|
||||
// @RequestMapping("/list")
|
||||
// public IPage<CxcSssjYasuojiBjls> list() {
|
||||
// LambdaQueryWrapper<CxcSssjYasuojiBjls> lmq = Wrappers.lambdaQuery();
|
||||
// lmq.between(CxcSssjYasuojiBjls::getBeginTime,"2023-08-21","2023-08-26");
|
||||
// lmq.eq(CxcSssjYasuojiBjls::getStationname,"文二联增压站");
|
||||
// lmq.eq(CxcSssjYasuojiBjls::getJizuhao,"一号机组");
|
||||
//
|
||||
// IPage<CxcSssjYasuojiBjls> iPage = new Page<>(2,4);
|
||||
// IPage<CxcSssjYasuojiBjls> list = yasuojBaojLssjMapper.selectPage(iPage,lmq);
|
||||
//
|
||||
// Map<String,String> mapjldxx = sssjTools.getJldnameByJldid("文二联增压站","一号机组");
|
||||
//
|
||||
// list.getRecords().forEach(item->{
|
||||
// item.setBjId(mapjldxx.get(item.getBjId()));
|
||||
// });
|
||||
//
|
||||
// log.info("total:"+list.getSize()+" "+list.getTotal());
|
||||
//
|
||||
// return list;
|
||||
// }
|
||||
|
||||
@RequestMapping("/listByZcAndJzh")
|
||||
public IPage<CxcSssjYasuojiBjls> listByZcAndJzh(@RequestParam(value = "pageNo") int pageNo,@RequestParam(value = "pageSize") int pageSize,@RequestParam(value = "zhanc") String zhanc,@RequestParam(value = "jzh") String jzh,@RequestParam(name = "startTime", required = false) String startTime,
|
||||
@RequestParam(name = "endTime", required = false) String endTime) {
|
||||
LambdaQueryWrapper<CxcSssjYasuojiBjls> lmq = Wrappers.lambdaQuery();
|
||||
lmq.between(CxcSssjYasuojiBjls::getBeginTime,startTime,endTime);
|
||||
lmq.eq(CxcSssjYasuojiBjls::getStationname,zhanc);
|
||||
lmq.eq(CxcSssjYasuojiBjls::getJizuhao,jzh);
|
||||
lmq.orderByAsc(CxcSssjYasuojiBjls::getBeginTime);
|
||||
|
||||
IPage<CxcSssjYasuojiBjls> iPage = new Page<>(pageNo,pageSize);
|
||||
IPage<CxcSssjYasuojiBjls> list = yasuojBaojLssjMapper.selectPage(iPage,lmq);
|
||||
|
||||
Map<String,String> mapjldxx = sssjTools.getJldnameByJldid(zhanc,jzh);
|
||||
|
||||
list.getRecords().forEach(item->{
|
||||
item.setBjId(mapjldxx.get(item.getBjId()));
|
||||
});
|
||||
|
||||
// log.info("total:"+list.getSize()+" "+list.getTotal());
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
public Result<?> edit(@RequestBody JSONObject params) {
|
||||
String id = params.getString("id");
|
||||
if (id.isEmpty()||id==null) {
|
||||
return Result.error("error");
|
||||
}
|
||||
|
||||
LambdaUpdateWrapper<CxcSssjYasuojiBjls> lmq = new LambdaUpdateWrapper<>();
|
||||
lmq.set(CxcSssjYasuojiBjls::getZt,"2");
|
||||
lmq.eq(CxcSssjYasuojiBjls::getId,id);
|
||||
yasuojiBaojLssjService.update(lmq);
|
||||
|
||||
net.minidev.json.JSONObject bjWebSocket = new net.minidev.json.JSONObject();
|
||||
bjWebSocket.put("cmd", "ysjbj110");//业务类型
|
||||
bjWebSocket.put("msgId", "1002");//消息id
|
||||
bjWebSocket.put("msgTxt", "压缩机报警数据改变!");//消息内容
|
||||
|
||||
try {
|
||||
webSocket.sendAllMessage(bjWebSocket.toJSONString());
|
||||
} catch (Exception e) {
|
||||
log.error("hi:" + e);
|
||||
}
|
||||
|
||||
return Result.ok("编辑成功!");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,309 @@
|
||||
package org.gyk.modules.lssj.yasuojishuju.controller;
|
||||
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.gyk.modules.lssj.yasuojishuju.entity.CxcSssjYasuoji;
|
||||
import org.gyk.modules.lssj.yasuojishuju.mapper.YasuojiMapper;
|
||||
import org.gyk.modules.lssj.yasuojishuju.service.IYasuojiLssjService;
|
||||
import org.gyk.modules.sssj.controller.GykController;
|
||||
import org.gyk.modules.sssj.util.sssjTools;
|
||||
import org.gyk.modules.sz.jldxx.entity.CxcSssjSzJldxx;
|
||||
import org.gyk.modules.sz.jldxx.mapper.CxcSssjSzJldxxMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="报警历史记录")
|
||||
@RestController
|
||||
@RequestMapping("/Yasuojlssj")
|
||||
@Slf4j
|
||||
public class YasuojiLssjController extends GykController{
|
||||
@Autowired
|
||||
private IYasuojiLssjService yasuojiLssjService;
|
||||
@Autowired(required = false)
|
||||
private YasuojiMapper yasuojiMapper;
|
||||
@Autowired(required = false)
|
||||
private CxcSssjSzJldxxMapper cxcSssjSzJldxxMapper;
|
||||
|
||||
// /**
|
||||
// * 添加
|
||||
// *
|
||||
// * @param cxcSssjYasuojiBjls
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-添加")
|
||||
// @ApiOperation(value="报警历史记录-添加", notes="报警历史记录-添加")
|
||||
// @PostMapping(value = "/add")
|
||||
// public Result<?> add(@RequestBody CxcSssjYasuojiBjls cxcSssjYasuojiBjls) {
|
||||
// yasuojiBaojLssjService.save(cxcSssjYasuojiBjls);
|
||||
// return Result.ok("添加成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 编辑
|
||||
// *
|
||||
// * @param cxcSssjYasuojiBjls
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-编辑")
|
||||
// @ApiOperation(value="报警历史记录-编辑", notes="报警历史记录-编辑")
|
||||
// @PutMapping(value = "/edit")
|
||||
// public Result<?> edit(@RequestBody CxcSssjYasuojiBjls cxcSssjYasuojiBjls) {
|
||||
// yasuojiBaojLssjService.updateById(cxcSssjYasuojiBjls);
|
||||
// return Result.ok("编辑成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 通过id删除
|
||||
// *
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-通过id删除")
|
||||
// @ApiOperation(value="报警历史记录-通过id删除", notes="报警历史记录-通过id删除")
|
||||
// @DeleteMapping(value = "/delete")
|
||||
// public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
// yasuojiBaojLssjService.removeById(id);
|
||||
// return Result.ok("删除成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 批量删除
|
||||
// *
|
||||
// * @param ids
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-批量删除")
|
||||
// @ApiOperation(value="报警历史记录-批量删除", notes="报警历史记录-批量删除")
|
||||
// @DeleteMapping(value = "/deleteBatch")
|
||||
// public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
// this.yasuojiBaojLssjService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
// return Result.ok("批量删除成功!");
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 通过id查询
|
||||
// *
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "报警历史记录-通过id查询")
|
||||
// @ApiOperation(value="报警历史记录-通过id查询", notes="报警历史记录-通过id查询")
|
||||
// @GetMapping(value = "/queryById")
|
||||
// public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
// CxcSssjYasuojiBjls cxcSssjYasuojiBjls = yasuojiBaojLssjService.getById(id);
|
||||
// if(cxcSssjYasuojiBjls ==null) {
|
||||
// return Result.error("未找到对应数据");
|
||||
// }
|
||||
// return Result.ok(cxcSssjYasuojiBjls);
|
||||
// }
|
||||
|
||||
@RequestMapping("/listByZcAndJzh")
|
||||
public IPage<Map<String,String>> listByZcAndJzh(@RequestParam(value = "pageNo") int pageNo, @RequestParam(value = "pageSize") int pageSize, @RequestParam(value = "zhanc") String zhanc, @RequestParam(value = "jzh") String jzh, @RequestParam(name = "startTime", required = false) String startTime,
|
||||
@RequestParam(name = "endTime", required = false) String endTime) {
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
List<Map<String,String>> listsj=new ArrayList<>();
|
||||
|
||||
LambdaQueryWrapper<CxcSssjYasuoji> lmq = Wrappers.lambdaQuery();
|
||||
lmq.between(CxcSssjYasuoji::getRq,startTime,endTime);
|
||||
lmq.eq(CxcSssjYasuoji::getStationName,zhanc);
|
||||
lmq.eq(CxcSssjYasuoji::getJizuHao,jzh);
|
||||
lmq.orderByAsc(CxcSssjYasuoji::getRq);
|
||||
|
||||
IPage<CxcSssjYasuoji> iPage = new Page<>(pageNo,pageSize);
|
||||
IPage<CxcSssjYasuoji> list = yasuojiMapper.selectPage(iPage,lmq);
|
||||
|
||||
if (list.getRecords().size()>0) {
|
||||
list.getRecords().forEach(item->{
|
||||
String shuju = item.getShuju();
|
||||
Map<String,String> mapshuju = sssjTools.splitStringToMap(shuju);
|
||||
mapshuju.put("日期",item.getRq().format(df));
|
||||
|
||||
listsj.add(mapshuju);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
IPage<Map<String,String>> page = new Page<>(pageNo,pageSize);
|
||||
page.setRecords(listsj);
|
||||
page.setTotal(list.getTotal());
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@RequestMapping("/getByZcAndJzh")
|
||||
public Map<String,List<String>> getByZcAndJzh( @RequestParam(value = "zhanc") String zhanc, @RequestParam(value = "jzh") String jzh,@RequestParam(value = "csname") String csname) {
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
DateTimeFormatter df2 = DateTimeFormatter.ofPattern("HH:mm:ss");
|
||||
DecimalFormat fnum = new DecimalFormat( "##0.00");
|
||||
LocalDateTime endTime = LocalDateTime.now();
|
||||
LocalDateTime startTime = endTime.plusHours(-8);
|
||||
|
||||
List<String> listrq=new ArrayList<>();
|
||||
List<String> listsj=new ArrayList<>();
|
||||
|
||||
LambdaQueryWrapper<CxcSssjSzJldxx> qw =new LambdaQueryWrapper<>();
|
||||
qw.eq(CxcSssjSzJldxx::getStationId,zhanc);
|
||||
qw.eq(CxcSssjSzJldxx::getJldlx,4);
|
||||
List<CxcSssjSzJldxx> cxcSssjSzJldxx = cxcSssjSzJldxxMapper.selectList(qw);
|
||||
if (cxcSssjSzJldxx.size()>0 ) {
|
||||
String zhancname = cxcSssjSzJldxx.get(0).getStationName();
|
||||
|
||||
// log.info("zhanc:"+cxcSssjSzJldxx.get(0).getStationName()+ " jzh:"+jzh);
|
||||
|
||||
LambdaQueryWrapper<CxcSssjYasuoji> lmq = Wrappers.lambdaQuery();
|
||||
lmq.between(CxcSssjYasuoji::getRq,startTime.format(df),endTime.format(df));
|
||||
lmq.eq(CxcSssjYasuoji::getStationName,zhancname);
|
||||
lmq.eq(CxcSssjYasuoji::getJizuHao,jzh);
|
||||
lmq.orderByAsc(CxcSssjYasuoji::getRq);
|
||||
|
||||
List<CxcSssjYasuoji> list = yasuojiMapper.selectList(lmq);
|
||||
|
||||
if (list.size()>0) {
|
||||
list.forEach(item->{
|
||||
String shuju = item.getShuju();
|
||||
Map<String,String> mapshuju = sssjTools.splitStringToMap(shuju);
|
||||
// mapshuju.put("日期",item.getRq().format(df));
|
||||
|
||||
listrq.add(item.getRq().format(df2));
|
||||
float ls = Float.parseFloat(mapshuju.get(csname));
|
||||
// String tmp = fnum.format(ls);
|
||||
// log.info("hi:"+tmp);
|
||||
listsj.add(fnum.format(ls));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String,List<String>> map = new HashMap<>();
|
||||
map.put("rq",listrq);
|
||||
map.put("shuju",listsj);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出Excel-动态头写入
|
||||
*
|
||||
* @param response response
|
||||
*/
|
||||
@GetMapping("/Export")
|
||||
public void dynamicHeadExport(HttpServletResponse response,@RequestParam(value = "zhanc") String zhanc, @RequestParam(value = "jzh") String jzh, @RequestParam(name = "startTime", required = false) String startTime,
|
||||
@RequestParam(name = "endTime", required = false) String endTime) throws IOException {
|
||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
DecimalFormat fnum = new DecimalFormat( "##0.0000");
|
||||
|
||||
// log.info("hi:"+jzh);
|
||||
|
||||
// 设置动态头
|
||||
List<List<String>> headList = new ArrayList<>();
|
||||
List<String> head = sssjTools.getYasuojshujuBt(zhanc,jzh).get("title");
|
||||
List<String> headbt = new ArrayList<>();
|
||||
head.forEach(item->{
|
||||
List<String> bt = new ArrayList<>();
|
||||
String ls = item.replace("*","");
|
||||
bt.add(ls);
|
||||
headbt.add(ls);
|
||||
headList.add(bt);
|
||||
});
|
||||
/* 简单的添加标题示例 **********************
|
||||
List<String> head0 = new ArrayList<>();
|
||||
head0.add("个人信息");
|
||||
head0.add("用户名");
|
||||
List<String> head1 = new ArrayList<>();
|
||||
head1.add("个人信息");
|
||||
head1.add("年龄");
|
||||
List<String> head2 = new ArrayList<>();
|
||||
head2.add("个人信息");
|
||||
head2.add("地址");
|
||||
headList.add(head0);
|
||||
headList.add(head1);
|
||||
headList.add(head2);
|
||||
|
||||
*/
|
||||
|
||||
LambdaQueryWrapper<CxcSssjYasuoji> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.between(CxcSssjYasuoji::getRq, startTime,endTime);
|
||||
queryWrapper.eq(CxcSssjYasuoji::getStationName,zhanc);
|
||||
queryWrapper.eq(CxcSssjYasuoji::getJizuHao,jzh);
|
||||
queryWrapper.orderByAsc(CxcSssjYasuoji::getRq);
|
||||
List<CxcSssjYasuoji> list = yasuojiLssjService.list(queryWrapper);
|
||||
|
||||
// List<YasuojiJcxx> ysjxx=sssjTools.ysjGykbz;
|
||||
// Map<String,String> getidbyname = new HashMap<>();
|
||||
// ysjxx.forEach(item->{
|
||||
// String[] tmpstr = item.getJldName().split("\\*");
|
||||
// if (tmpstr[1].equals("四号机组") && item.getStationName().equals("文二联增压站")) {
|
||||
// getidbyname.put(tmpstr[2],item.getGykbz());
|
||||
// }
|
||||
// });
|
||||
|
||||
// 获取动态数据
|
||||
List<List<Object>> dataList = new ArrayList<>();
|
||||
|
||||
// Map<String,String> mapdata = new HashMap<>();
|
||||
list.forEach(item->{
|
||||
String shuju = item.getShuju();
|
||||
Map<String,String> mapshuju = sssjTools.splitStringToMap(shuju);
|
||||
// mapshuju.forEach((k,v)->{
|
||||
// mapdata.put(k+item.getRq(),v);
|
||||
// });
|
||||
List<Object> data = new ArrayList<>();
|
||||
for(int i=0;i<headbt.size();i++) {
|
||||
String tmpstr=headbt.get(i); //获取的是压缩机参数名
|
||||
// String tmpid = getidbyname.get(tmpstr);
|
||||
if (tmpstr.equals("日期")) {
|
||||
data.add(item.getRq().format(df));
|
||||
} else {
|
||||
String val = mapshuju.get(tmpstr);
|
||||
float floatval = (val==null)? 0.0000f : Float.parseFloat(val);
|
||||
// String lastval =fnum.format(floatval);
|
||||
if (Math.abs(floatval-0.0f)<0.00001f) {
|
||||
data.add("0");
|
||||
} else {
|
||||
data.add(floatval);
|
||||
}
|
||||
}
|
||||
// log.info("hi:"+data.toString());
|
||||
}
|
||||
dataList.add(data);
|
||||
});
|
||||
|
||||
// 设置响应头
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 设置防止中文名乱码
|
||||
String filename = URLEncoder.encode(zhanc, "utf-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + filename + ".xls");
|
||||
|
||||
// 先仅仅写入头,再以不写入头的方式写入数据
|
||||
EasyExcel.write(response.getOutputStream()).head(headList).sheet(jzh).doWrite(dataList);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package org.gyk.modules.lssj.yasuojishuju.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public class CxcSssjYasuoji implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
private String departName;
|
||||
private String stationName;
|
||||
private String jizuHao;
|
||||
private LocalDateTime rq;
|
||||
private String shuju;
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDepartName() {
|
||||
return departName;
|
||||
}
|
||||
|
||||
public void setDepartName(String departName) {
|
||||
this.departName = departName;
|
||||
}
|
||||
|
||||
public String getStationName() {
|
||||
return stationName;
|
||||
}
|
||||
|
||||
public void setStationName(String stationName) {
|
||||
this.stationName = stationName;
|
||||
}
|
||||
|
||||
public String getJizuHao() {
|
||||
return jizuHao;
|
||||
}
|
||||
|
||||
public void setJizuHao(String jizuHao) {
|
||||
this.jizuHao = jizuHao;
|
||||
}
|
||||
|
||||
public LocalDateTime getRq() {
|
||||
return rq;
|
||||
}
|
||||
|
||||
public void setRq(LocalDateTime rq) {
|
||||
this.rq = rq;
|
||||
}
|
||||
|
||||
public String getShuju() {
|
||||
return shuju;
|
||||
}
|
||||
|
||||
public void setShuju(String shuju) {
|
||||
this.shuju = shuju;
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package org.gyk.modules.lssj.yasuojishuju.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public class CxcSssjYasuojiBjls implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**ID*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private String id;
|
||||
/**报警点ID*/
|
||||
@Excel(name = "报警点ID", width = 15)
|
||||
@ApiModelProperty(value = "报警点ID")
|
||||
private String bjId;
|
||||
/**报警时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "报警时间")
|
||||
private Date beginTime;
|
||||
/**报警结束时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "报警时间")
|
||||
private Date endTime;
|
||||
|
||||
/**报警值*/
|
||||
@Excel(name = "报警值", width = 15)
|
||||
@ApiModelProperty(value = "报警值")
|
||||
private String canshuZhi;
|
||||
/**报警描述*/
|
||||
@Excel(name = "报警描述", width = 15)
|
||||
@ApiModelProperty(value = "报警描述")
|
||||
private String bjMs;
|
||||
private String stationname;
|
||||
private String jizuhao;
|
||||
private String zt;
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getBjId() {
|
||||
return bjId;
|
||||
}
|
||||
|
||||
public void setBjId(String bjId) {
|
||||
this.bjId = bjId;
|
||||
}
|
||||
|
||||
public Date getBeginTime() {
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
public void setBeginTime(Date beginTime) {
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getCanshuZhi() {
|
||||
return canshuZhi;
|
||||
}
|
||||
|
||||
public void setCanshuZhi(String canshuZhi) {
|
||||
this.canshuZhi = canshuZhi;
|
||||
}
|
||||
|
||||
public String getBjMs() {
|
||||
return bjMs;
|
||||
}
|
||||
|
||||
public void setBjMs(String bjMs) {
|
||||
this.bjMs = bjMs;
|
||||
}
|
||||
|
||||
public String getStationname() {
|
||||
return stationname;
|
||||
}
|
||||
|
||||
public void setStationname(String stationname) {
|
||||
this.stationname = stationname;
|
||||
}
|
||||
|
||||
public String getJizuhao() {
|
||||
return jizuhao;
|
||||
}
|
||||
|
||||
public void setJizuhao(String jizuhao) {
|
||||
this.jizuhao = jizuhao;
|
||||
}
|
||||
|
||||
public String getZt() {
|
||||
return zt;
|
||||
}
|
||||
|
||||
public void setZt(String zt) {
|
||||
this.zt = zt;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package org.gyk.modules.lssj.yasuojishuju.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.gyk.modules.lssj.yasuojishuju.entity.CxcSssjYasuojiBjls;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
@DS("slave")
|
||||
public interface YasuojBaojLssjMapper extends BaseMapper<CxcSssjYasuojiBjls> {
|
||||
// IPage<CxcSssjYasuojiBjls> selectPage(Page page);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package org.gyk.modules.lssj.yasuojishuju.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.gyk.modules.lssj.yasuojishuju.entity.CxcSssjYasuoji;
|
||||
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
//import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
@DS("slave")
|
||||
public interface YasuojiMapper extends BaseMapper<CxcSssjYasuoji> {
|
||||
// IPage<CxcSssjYasuojiBjls> selectPage(Page page);
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.gyk.modules.lssj.bjls.mapper.CxcSssjLssjBjlsjlMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.gyk.modules.lssj.yasuojishuju.mapper.YasuojiMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
package org.gyk.modules.lssj.yasuojishuju.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.gyk.modules.lssj.yasuojishuju.entity.CxcSssjYasuojiBjls;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IYasuojiBaojLssjService extends IService<CxcSssjYasuojiBjls> {
|
||||
// public IPage<CxcSssjYasuojiBjls> selectPage(Page<CxcSssjYasuojiBjls> page);
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package org.gyk.modules.lssj.yasuojishuju.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.gyk.modules.lssj.yasuojishuju.entity.CxcSssjYasuoji;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IYasuojiLssjService extends IService<CxcSssjYasuoji> {
|
||||
// public IPage<CxcSssjYasuojiBjls> selectPage(Page<CxcSssjYasuojiBjls> page);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package org.gyk.modules.lssj.yasuojishuju.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.gyk.modules.lssj.yasuojishuju.entity.CxcSssjYasuojiBjls;
|
||||
import org.gyk.modules.lssj.yasuojishuju.mapper.YasuojBaojLssjMapper;
|
||||
import org.gyk.modules.lssj.yasuojishuju.service.IYasuojiBaojLssjService;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
|
||||
public class YasuojiBaojLssjServiceImpl extends ServiceImpl<YasuojBaojLssjMapper, CxcSssjYasuojiBjls> implements IYasuojiBaojLssjService {
|
||||
// @Override
|
||||
// public IPage<CxcSssjYasuojiBjls> selectPage(Page<CxcSssjYasuojiBjls> page) {
|
||||
// return baseMapper.
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package org.gyk.modules.lssj.yasuojishuju.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.gyk.modules.lssj.yasuojishuju.entity.CxcSssjYasuoji;
|
||||
import org.gyk.modules.lssj.yasuojishuju.mapper.YasuojiMapper;
|
||||
import org.gyk.modules.lssj.yasuojishuju.service.IYasuojiLssjService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Description: 报警历史记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class YasuojiLssjServiceImpl extends ServiceImpl<YasuojiMapper,CxcSssjYasuoji> implements IYasuojiLssjService {
|
||||
|
||||
}
|
@ -0,0 +1,214 @@
|
||||
package org.gyk.modules.modbus.serialPort;
|
||||
|
||||
import jssc.SerialPort;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Class that wraps a {@link SerialPort} to provide {@link InputStream}
|
||||
* functionality. This stream also provides support for performing blocking
|
||||
* reads with timeouts.
|
||||
* <br>
|
||||
* It is instantiated by passing the constructor a {@link SerialPort} instance.
|
||||
* Do not create multiple streams for the same serial port unless you implement
|
||||
* your own synchronization.
|
||||
*
|
||||
* @author Charles Hache <chalz@member.fsf.org>
|
||||
*
|
||||
* Attribution: https://github.com/therealchalz/java-simple-serial-connector
|
||||
*
|
||||
*/
|
||||
public class SerialInputStream extends InputStream {
|
||||
|
||||
private SerialPort serialPort;
|
||||
private int defaultTimeout = 0;
|
||||
|
||||
/**
|
||||
* Instantiates a SerialInputStream for the given {@link SerialPort} Do not
|
||||
* create multiple streams for the same serial port unless you implement
|
||||
* your own synchronization.
|
||||
*
|
||||
* @param sp The serial port to stream.
|
||||
*/
|
||||
public SerialInputStream(SerialPort sp) {
|
||||
serialPort = sp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default timeout (ms) of this SerialInputStream. This affects
|
||||
* subsequent calls to {@link #read()}, {@link #(int[])}, and
|
||||
* {@link #(int[], int, int)} The default timeout can be 'unset'
|
||||
* by setting it to 0.
|
||||
*
|
||||
* @param time The timeout in milliseconds.
|
||||
*/
|
||||
public void setTimeout(int time) {
|
||||
defaultTimeout = time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the next byte from the port. If the timeout of this stream has been
|
||||
* set, then this method blocks until data is available or until the timeout
|
||||
* has been hit. If the timeout is not set or has been set to 0, then this
|
||||
* method blocks indefinitely.
|
||||
*/
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return read(defaultTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* The same contract as {@link #read()}, except overrides this stream's
|
||||
* default timeout with the given timeout in milliseconds.
|
||||
*
|
||||
* @param timeout The timeout in milliseconds.
|
||||
* @return The read byte.
|
||||
* @throws IOException On serial port error or timeout
|
||||
*/
|
||||
public int read(int timeout) throws IOException {
|
||||
byte[] buf = new byte[1];
|
||||
try {
|
||||
if (timeout > 0) {
|
||||
buf = serialPort.readBytes(1, timeout);
|
||||
} else {
|
||||
buf = serialPort.readBytes(1);
|
||||
}
|
||||
return buf[0];
|
||||
} catch (Exception e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-blocking read of up to buf.length bytes from the stream. This call
|
||||
* behaves as read(buf, 0, buf.length) would.
|
||||
*
|
||||
* @param buf The buffer to fill.
|
||||
* @return The number of bytes read, which can be 0.
|
||||
* @throws IOException on error.
|
||||
*/
|
||||
@Override
|
||||
public int read(byte[] buf) throws IOException {
|
||||
return read(buf, 0, buf.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-blocking read of up to length bytes from the stream. This method
|
||||
* returns what is immediately available in the input buffer.
|
||||
*
|
||||
* @param buf The buffer to fill.
|
||||
* @param offset The offset into the buffer to start copying data.
|
||||
* @param length The maximum number of bytes to read.
|
||||
* @return The actual number of bytes read, which can be 0.
|
||||
* @throws IOException on error.
|
||||
*/
|
||||
@Override
|
||||
public int read(byte[] buf, int offset, int length) throws IOException {
|
||||
|
||||
if (buf.length < offset + length) {
|
||||
length = buf.length - offset;
|
||||
}
|
||||
|
||||
int available = this.available();
|
||||
|
||||
if (available > length) {
|
||||
available = length;
|
||||
}
|
||||
|
||||
try {
|
||||
byte[] readBuf = serialPort.readBytes(available);
|
||||
// System.arraycopy(readBuf, 0, buf, offset, length);
|
||||
System.arraycopy(readBuf, 0, buf, offset, readBuf.length);
|
||||
return readBuf.length;
|
||||
} catch (Exception e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks until buf.length bytes are read, an error occurs, or the default
|
||||
* timeout is hit (if specified). This behaves as blockingRead(buf, 0,
|
||||
* buf.length) would.
|
||||
*
|
||||
* @param buf The buffer to fill with data.
|
||||
* @return The number of bytes read.
|
||||
* @throws IOException On error or timeout.
|
||||
*/
|
||||
public int blockingRead(byte[] buf) throws IOException {
|
||||
return blockingRead(buf, 0, buf.length, defaultTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* The same contract as {@link #blockingRead(byte[])} except overrides this
|
||||
* stream's default timeout with the given one.
|
||||
*
|
||||
* @param buf The buffer to fill.
|
||||
* @param timeout The timeout in milliseconds.
|
||||
* @return The number of bytes read.
|
||||
* @throws IOException On error or timeout.
|
||||
*/
|
||||
public int blockingRead(byte[] buf, int timeout) throws IOException {
|
||||
return blockingRead(buf, 0, buf.length, timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks until length bytes are read, an error occurs, or the default
|
||||
* timeout is hit (if specified). Saves the data into the given buffer at
|
||||
* the specified offset. If the stream's timeout is not set, behaves as
|
||||
* {@link #read(byte[], int, int)} would.
|
||||
*
|
||||
* @param buf The buffer to fill.
|
||||
* @param offset The offset in buffer to save the data.
|
||||
* @param length The number of bytes to read.
|
||||
* @return the number of bytes read.
|
||||
* @throws IOException on error or timeout.
|
||||
*/
|
||||
public int blockingRead(byte[] buf, int offset, int length) throws IOException {
|
||||
return blockingRead(buf, offset, length, defaultTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* The same contract as {@link #blockingRead(byte[], int, int)} except
|
||||
* overrides this stream's default timeout with the given one.
|
||||
*
|
||||
* @param buf The buffer to fill.
|
||||
* @param offset Offset in the buffer to start saving data.
|
||||
* @param length The number of bytes to read.
|
||||
* @param timeout The timeout in milliseconds.
|
||||
* @return The number of bytes read.
|
||||
* @throws IOException On error or timeout.
|
||||
*/
|
||||
public int blockingRead(byte[] buf, int offset, int length, int timeout) throws IOException {
|
||||
if (buf.length < offset + length) {
|
||||
throw new IOException("Not enough buffer space for serial data");
|
||||
}
|
||||
|
||||
if (timeout < 1) {
|
||||
return read(buf, offset, length);
|
||||
}
|
||||
|
||||
try {
|
||||
byte[] readBuf = serialPort.readBytes(length, timeout);
|
||||
System.arraycopy(readBuf, 0, buf, offset, length);
|
||||
return readBuf.length;
|
||||
} catch (Exception e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
int ret;
|
||||
try {
|
||||
ret = serialPort.getInputBufferBytesCount();
|
||||
if (ret >= 0) {
|
||||
return ret;
|
||||
}
|
||||
throw new IOException("Error checking available bytes from the serial port.");
|
||||
} catch (Exception e) {
|
||||
throw new IOException("Error checking available bytes from the serial port."+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package org.gyk.modules.modbus.serialPort;
|
||||
|
||||
import jssc.SerialPort;
|
||||
import jssc.SerialPortException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* Class that wraps a {@link SerialPort} to provide {@link OutputStream}
|
||||
* functionality.
|
||||
* <br>
|
||||
* It is instantiated by passing the constructor a {@link SerialPort} instance.
|
||||
* Do not create multiple streams for the same serial port unless you implement
|
||||
* your own synchronization.
|
||||
*
|
||||
* @author Charles Hache <chalz@member.fsf.org>
|
||||
*
|
||||
* Attribution: https://github.com/therealchalz/java-simple-serial-connector
|
||||
*
|
||||
*/
|
||||
public class SerialOutputStream extends OutputStream {
|
||||
|
||||
SerialPort serialPort;
|
||||
|
||||
/**
|
||||
* Instantiates a SerialOutputStream for the given {@link SerialPort} Do not
|
||||
* create multiple streams for the same serial port unless you implement
|
||||
* your own synchronization.
|
||||
*
|
||||
* @param sp The serial port to stream.
|
||||
*/
|
||||
public SerialOutputStream(SerialPort sp) {
|
||||
serialPort = sp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
try {
|
||||
serialPort.writeInt(b);
|
||||
} catch (SerialPortException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException {
|
||||
write(b, 0, b.length);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
byte[] buffer = new byte[len];
|
||||
System.arraycopy(b, off, buffer, 0, len);
|
||||
try {
|
||||
serialPort.writeBytes(buffer);
|
||||
} catch (SerialPortException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package org.gyk.modules.modbus.serialPort;
|
||||
|
||||
import com.serotonin.modbus4j.serial.SerialPortWrapper;
|
||||
import jssc.SerialPort;
|
||||
import jssc.SerialPortException;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class SerialPortWrapperImpl implements SerialPortWrapper {
|
||||
|
||||
// private static final Logger LOG = LoggerFactory.getLogger(SerialPortWrapperImpl.class);
|
||||
private SerialPort port;
|
||||
private String commPortId;
|
||||
private int baudRate;
|
||||
private int dataBits;
|
||||
private int stopBits;
|
||||
private int parity;
|
||||
private int flowControlIn;
|
||||
private int flowControlOut;
|
||||
|
||||
public SerialPortWrapperImpl(String commPortId, int baudRate, int dataBits, int stopBits, int parity, int flowControlIn,
|
||||
int flowControlOut) {
|
||||
|
||||
this.commPortId = commPortId;
|
||||
this.baudRate = baudRate;
|
||||
this.dataBits = dataBits;
|
||||
this.stopBits = stopBits;
|
||||
this.parity = parity;
|
||||
this.flowControlIn = flowControlIn;
|
||||
this.flowControlOut = flowControlOut;
|
||||
|
||||
port = new SerialPort(this.commPortId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
port.closePort();
|
||||
//listeners.forEach(PortConnectionListener::closed);
|
||||
// LOG.debug("Serial port {} closed", port.getPortName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
try {
|
||||
port.openPort();
|
||||
port.setParams(this.getBaudRate(), this.getDataBits(), this.getStopBits(), this.getParity());
|
||||
port.setFlowControlMode(this.getFlowControlIn() | this.getFlowControlOut());
|
||||
|
||||
//listeners.forEach(PortConnectionListener::opened);
|
||||
// LOG.debug("Serial port {} opened", port.getPortName());
|
||||
} catch (SerialPortException ex) {
|
||||
// LOG.error("Error opening port : {} for {} ", port.getPortName(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() {
|
||||
return new SerialInputStream(port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OutputStream getOutputStream() {
|
||||
return new SerialOutputStream(port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBaudRate() {
|
||||
return baudRate;
|
||||
//return SerialPort.BAUDRATE_9600;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlowControlIn() {
|
||||
return flowControlIn;
|
||||
//return SerialPort.FLOWCONTROL_NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlowControlOut() {
|
||||
return flowControlOut;
|
||||
//return SerialPort.FLOWCONTROL_NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataBits() {
|
||||
return dataBits;
|
||||
//return SerialPort.DATABITS_8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStopBits() {
|
||||
return stopBits;
|
||||
//return SerialPort.STOPBITS_1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getParity() {
|
||||
return parity;
|
||||
//return SerialPort.PARITY_NONE;
|
||||
}
|
||||
}
|
219
src/main/java/org/gyk/modules/modbus/utils/ModbusTools.java
Normal file
219
src/main/java/org/gyk/modules/modbus/utils/ModbusTools.java
Normal file
@ -0,0 +1,219 @@
|
||||
//package org.gyk.modules.sssj.util;
|
||||
//
|
||||
//import com.serotonin.io.serial.SerialParameters;
|
||||
//import com.serotonin.modbus4j.ModbusFactory;
|
||||
//import com.serotonin.modbus4j.ModbusMaster;
|
||||
//import com.serotonin.modbus4j.code.DataType;
|
||||
//import com.serotonin.modbus4j.exception.ErrorResponseException;
|
||||
//import com.serotonin.modbus4j.exception.ModbusInitException;
|
||||
//import com.serotonin.modbus4j.exception.ModbusTransportException;
|
||||
//import com.serotonin.modbus4j.ip.IpParameters;
|
||||
//import com.serotonin.modbus4j.msg.*;
|
||||
//import com.serotonin.modbus4j.locator.BaseLocator;
|
||||
//import com.serotonin.util.queue.ByteQueue;
|
||||
//import org.gyk.modules.sssj.entity.JldPar;
|
||||
//
|
||||
//import java.math.BigInteger;
|
||||
//import java.time.LocalDateTime;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Arrays;
|
||||
//import java.util.List;
|
||||
///**
|
||||
// * @Description: MODBUS通讯数据获取
|
||||
// * @Author: liao
|
||||
// * @Date: 2021-04-05
|
||||
// * @Version: V1.0
|
||||
// */
|
||||
//
|
||||
//public class ModbusTools {
|
||||
//
|
||||
// public static String getComData() {
|
||||
//
|
||||
// /* 创建ModbusFactory实例 */
|
||||
// ModbusFactory modbusFactory = new ModbusFactory();
|
||||
// //创建Com参数
|
||||
// SerialParameters serialParameters = new SerialParameters();
|
||||
//
|
||||
// /* 设定MODBUS通讯的串行口 */
|
||||
// serialParameters.setCommPortId("COM1");
|
||||
// /* 设定成无奇偶校验 */
|
||||
// serialParameters.setParity(0);
|
||||
// /* 设定成数据位是8位 */
|
||||
// serialParameters.setDataBits(8);
|
||||
// /* 设定为1个停止位 */
|
||||
// serialParameters.setStopBits(1);
|
||||
// /* 设定端口名称 */
|
||||
// serialParameters.setPortOwnerName("COM1");
|
||||
// /* 设定端口波特率 */
|
||||
// serialParameters.setBaudRate(9600);
|
||||
//
|
||||
// /* 创建ModbusMaster实例 */
|
||||
// ModbusMaster master = modbusFactory.createRtuMaster(serialParameters);
|
||||
// /* 初始化 */
|
||||
// try {
|
||||
// master.init();
|
||||
// System.out.println("======PLC通讯初始化成功=======");
|
||||
// } catch (ModbusInitException e) {
|
||||
// System.out.println("======PLC通讯初始化异常=======");
|
||||
// }
|
||||
// ModbusRequest modbusRequest = null;
|
||||
// //读取寄存器的值
|
||||
// try {
|
||||
// //PLC读取参数 通过站内部计量点ID号读取,30个参数,60个地址 240个寄存器
|
||||
// modbusRequest = new ReadHoldingRegistersRequest(1, 1, 60);
|
||||
// } catch (ModbusTransportException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// ModbusResponse modbusResponse = null;
|
||||
// try {
|
||||
// //向现场的PLC发送读取请求
|
||||
// modbusResponse = master.send(modbusRequest);
|
||||
// } catch (ModbusTransportException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// // 定义存放读取的寄存器数据的变量 类型未知 需要现场调试
|
||||
// ByteQueue byteQueue = new ByteQueue(60);
|
||||
// modbusResponse.write(byteQueue);
|
||||
// return "";
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 读保持寄存器上的内容
|
||||
// *
|
||||
// * @param master 主站
|
||||
// * @param slaveId 从站地址
|
||||
// * @param start 起始地址的偏移量
|
||||
// * @param len 待读寄存器的个数
|
||||
// */
|
||||
// private static void readHoldingRegistersTest(ModbusMaster master, int slaveId, int start, int len) {
|
||||
// try {
|
||||
// ReadHoldingRegistersRequest request = new ReadHoldingRegistersRequest(slaveId, start, len);
|
||||
// ReadHoldingRegistersResponse response = (ReadHoldingRegistersResponse) master.send(request);
|
||||
// if (response.isException()) {
|
||||
// System.out.println("异常消息:" + response.getExceptionMessage());
|
||||
// } else {
|
||||
// System.out.println(Arrays.toString(response.getShortData()));
|
||||
// short[] list = response.getShortData();
|
||||
// for (int i = 0; i < list.length; i++) {
|
||||
// System.out.print(list[i] + " ");
|
||||
// }
|
||||
// }
|
||||
// } catch (ModbusTransportException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static List<JldPar> getPar(String Ip, Integer port, Integer jldNo) {
|
||||
// /* 创建ModbusFactory实例 */
|
||||
// ModbusFactory modbusFactory = new ModbusFactory();
|
||||
// //创建Tcp IP参数
|
||||
// IpParameters ipParameters = new IpParameters();
|
||||
// ipParameters.setHost(Ip);
|
||||
//
|
||||
// /* 创建ModbusMaster实例 */
|
||||
// ModbusMaster master = modbusFactory.createTcpMaster(ipParameters, true);
|
||||
// /* 初始化 */
|
||||
// try {
|
||||
// master.init();
|
||||
// System.out.println("======PLC通讯初始化成功=======");
|
||||
// } catch (ModbusInitException e) {
|
||||
// System.out.println("======PLC通讯初始化异常=======");
|
||||
// }
|
||||
// ModbusRequest modbusRequest = null;
|
||||
// //读取寄存器的值
|
||||
// try {
|
||||
// //PLC读取参数 通过站内部计量点ID号读取,30个参数,60个地址, 240个寄存器, 24360 PLC中参数起始地址
|
||||
// modbusRequest = new ReadHoldingRegistersRequest(1, 24360 + 240 * jldNo, 60);
|
||||
// } catch (ModbusTransportException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// ModbusResponse modbusResponse = null;
|
||||
// try {
|
||||
// //向现场的PLC发送读取请求
|
||||
// modbusResponse = master.send(modbusRequest);
|
||||
// } catch (ModbusTransportException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// // 定义存放读取的寄存器数据的变量 类型未知 需要现场调试
|
||||
// ByteQueue byteQueue = new ByteQueue(60);
|
||||
// modbusResponse.write(byteQueue);
|
||||
// List<JldPar> listPar = tranData(byteQueue);
|
||||
// return listPar;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private static List<JldPar> tranData(ByteQueue byteQueue) {
|
||||
// List<JldPar> listPar = new ArrayList<>();
|
||||
//
|
||||
// String[] tempWord;
|
||||
// tempWord = new String[120];
|
||||
// for (int j = 0; j < 120; j++) {
|
||||
// tempWord[j] = String.format("%02x", byteQueue.peek(j+3));
|
||||
// }
|
||||
//
|
||||
// String [] strWord=new String[60];
|
||||
// for (int j = 0; j < 60; j++) {
|
||||
// strWord[j] = tempWord[j*2]+tempWord[j*2+1];
|
||||
// }
|
||||
//
|
||||
//
|
||||
// String[] sngPar = new String[30];
|
||||
//
|
||||
// for (int j = 0; j < 30; j++) {
|
||||
// if (j <= 21) {
|
||||
// sngPar[j] = String.valueOf(getFloat(strWord[j * 2 + 1] + strWord[j * 2]));
|
||||
// } else {
|
||||
// sngPar[j] = String.valueOf(getFloat(strWord[j * 2 + 1] + strWord[j * 2]));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// JldPar jldPar = new JldPar();
|
||||
// jldPar.setReadTime(LocalDateTime.now().toString());
|
||||
// jldPar.setCH4(sngPar[0]);
|
||||
// jldPar.setN2(sngPar[1]);
|
||||
// jldPar.setCO2(sngPar[2]);
|
||||
// jldPar.setC2H6(sngPar[3]);
|
||||
// jldPar.setC3H8(sngPar[4]);
|
||||
// jldPar.setH2O(sngPar[5]);
|
||||
// jldPar.setH2S(sngPar[6]);
|
||||
// jldPar.setH2(sngPar[7]);
|
||||
// jldPar.setCO(sngPar[8]);
|
||||
// jldPar.setO2(sngPar[9]);
|
||||
// jldPar.setI_C4H10(sngPar[10]);
|
||||
// jldPar.setN_C4H10(sngPar[11]);
|
||||
// jldPar.setI_C5H12(sngPar[12]);
|
||||
// jldPar.setN_C5H12(sngPar[13]);
|
||||
// jldPar.setN_C6H14(sngPar[14]);
|
||||
// jldPar.setN_C7H16(sngPar[15]);
|
||||
// jldPar.setN_C8H18(sngPar[16]);
|
||||
// jldPar.setN_C9H20(sngPar[17]);
|
||||
// jldPar.setN_C10H22(sngPar[18]);
|
||||
// jldPar.setHe(sngPar[19]);
|
||||
// jldPar.setAr(sngPar[20]);
|
||||
// jldPar.setBak(sngPar[21]);
|
||||
// jldPar.setGJ(sngPar[22]);
|
||||
// jldPar.setKJ(sngPar[23]);
|
||||
// jldPar.setGr(sngPar[24]);
|
||||
// jldPar.setDLND(sngPar[25]);
|
||||
// jldPar.setDSZS(sngPar[26]);
|
||||
// jldPar.setBAK1(sngPar[27]);
|
||||
// jldPar.setBAK2(sngPar[28]);
|
||||
// jldPar.setBAK3("读取成功");
|
||||
//
|
||||
// listPar.add(jldPar);
|
||||
// return listPar;
|
||||
// }
|
||||
//
|
||||
// private static float getFloat(String _strData) {
|
||||
// float f = Float.intBitsToFloat(new BigInteger(_strData,16).intValue());
|
||||
// return f;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//// public static int getInt(byte[] bytes) {
|
||||
//// return (0xff & bytes[0]) | (0xff00 & (bytes[1] << 8)) | (0xff0000 & (bytes[2] << 16)) | (0xff000000 & (bytes[3] << 24));
|
||||
//// }
|
||||
//
|
||||
//
|
||||
//}
|
670
src/main/java/org/gyk/modules/modbus/utils/modBusUtils.java
Normal file
670
src/main/java/org/gyk/modules/modbus/utils/modBusUtils.java
Normal file
@ -0,0 +1,670 @@
|
||||
package org.gyk.modules.modbus.utils;
|
||||
|
||||
import com.serotonin.modbus4j.BatchRead;
|
||||
import com.serotonin.modbus4j.BatchResults;
|
||||
import com.serotonin.modbus4j.ModbusFactory;
|
||||
import com.serotonin.modbus4j.ModbusMaster;
|
||||
import com.serotonin.modbus4j.code.DataType;
|
||||
import com.serotonin.modbus4j.exception.ErrorResponseException;
|
||||
import com.serotonin.modbus4j.exception.ModbusInitException;
|
||||
import com.serotonin.modbus4j.exception.ModbusTransportException;
|
||||
import com.serotonin.modbus4j.ip.IpParameters;
|
||||
import com.serotonin.modbus4j.locator.BaseLocator;
|
||||
import com.serotonin.modbus4j.msg.*;
|
||||
import jssc.SerialPort;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gyk.modules.modbus.serialPort.SerialPortWrapperImpl;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
|
||||
/**
|
||||
* modbus-tcp的工具类
|
||||
*
|
||||
* jiang,20231012
|
||||
*/
|
||||
@Slf4j
|
||||
public class modBusUtils {
|
||||
|
||||
/**
|
||||
* 工厂。
|
||||
*/
|
||||
static ModbusFactory modbusFactory;
|
||||
|
||||
static {
|
||||
if (modbusFactory == null) {
|
||||
modbusFactory = new ModbusFactory();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取master
|
||||
*
|
||||
* @throws ModbusInitException
|
||||
*/
|
||||
public static ModbusMaster getMaster(String host, int port) {
|
||||
|
||||
IpParameters params = new IpParameters();
|
||||
params.setHost(host);
|
||||
params.setPort(port);
|
||||
// modbusFactory.createRtuMaster(wapper); //RTU 协议
|
||||
// modbusFactory.createUdpMaster(params);//UDP 协议
|
||||
// modbusFactory.createAsciiMaster(wrapper);//ASCII 协议
|
||||
ModbusMaster master = modbusFactory.createTcpMaster(params, false);// TCP 协议
|
||||
try {
|
||||
master.init();
|
||||
} catch (ModbusInitException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return master;
|
||||
}
|
||||
|
||||
public static ModbusMaster getRtuIpMaster(String host, int port) {
|
||||
IpParameters params = new IpParameters();
|
||||
params.setHost(host);
|
||||
params.setPort(port);
|
||||
params.setEncapsulated(true);
|
||||
ModbusMaster master = modbusFactory.createTcpMaster(params, false);
|
||||
try {
|
||||
//设置超时时间
|
||||
master.setTimeout(1000);
|
||||
//设置重连次数
|
||||
master.setRetries(3);
|
||||
//初始化
|
||||
master.init();
|
||||
} catch (ModbusInitException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return master;
|
||||
}
|
||||
|
||||
/**
|
||||
* RTU
|
||||
* @return
|
||||
* @throws ModbusInitException
|
||||
*/
|
||||
public static ModbusMaster getSerialPortRtuMaster(){
|
||||
// 设置串口参数,串口是COM1,波特率是9600
|
||||
SerialPortWrapperImpl wrapper = new SerialPortWrapperImpl("COM2", 9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE, 0, 0);
|
||||
// SerialPortWrapperImpl wrapper = new SerialPortWrapperImpl(portName, baudRate,
|
||||
// dataBits, stopBits, parity, 0, 0);
|
||||
ModbusMaster master = modbusFactory.createRtuMaster(wrapper);
|
||||
try {
|
||||
//设置超时时间
|
||||
master.setTimeout(1000);
|
||||
//设置重连次数
|
||||
master.setRetries(3);
|
||||
//初始化
|
||||
master.init();
|
||||
} catch (ModbusInitException e) {
|
||||
log.error("串口连接异常~");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return master;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param portName 串口名
|
||||
* @param baudRate 波特率
|
||||
* @param dataBits 数据位
|
||||
* @param stopBits 中止位
|
||||
* @param parity 校验位
|
||||
* @return
|
||||
* @throws ModbusInitException
|
||||
*/
|
||||
public static ModbusMaster getSerialPortAsciiMaster(String portName, Integer baudRate, Integer dataBits,
|
||||
Integer stopBits, Integer parity){
|
||||
// 设置串口参数,串口是COM1,波特率是9600
|
||||
// SerialPortWrapperImpl wrapper = new SerialPortWrapperImpl("COM2", 9600,SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE, 0, 0);
|
||||
SerialPortWrapperImpl wrapper = new SerialPortWrapperImpl(portName, baudRate,
|
||||
dataBits, stopBits, parity, 0, 0);
|
||||
ModbusMaster master = modbusFactory.createAsciiMaster(wrapper);
|
||||
try {
|
||||
//设置超时时间
|
||||
master.setTimeout(1000);
|
||||
//设置重连次数
|
||||
master.setRetries(3);
|
||||
//初始化
|
||||
master.init();
|
||||
} catch (ModbusInitException e) {
|
||||
log.error("串口连接异常~");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return master;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取[01 Coil Status 0x]类型 开关数据
|
||||
*
|
||||
* @param slaveId
|
||||
* slaveId 从地址 (仪表地址)
|
||||
* @param offset
|
||||
* 位置
|
||||
* @return 读取值
|
||||
* @throws ModbusTransportException
|
||||
* 异常
|
||||
* @throws ErrorResponseException
|
||||
* 异常
|
||||
*/
|
||||
public static Boolean readCoilStatus(int slaveId, int offset,String ip ,int prot)
|
||||
throws ModbusTransportException, ErrorResponseException {
|
||||
// 01 Coil Status
|
||||
BaseLocator<Boolean> loc = BaseLocator.coilStatus(slaveId, offset);
|
||||
Boolean value = getMaster(ip, prot).getValue(loc);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取[02 Input Status 1x]类型 开关数据
|
||||
*
|
||||
* @param slaveId
|
||||
* @param offset
|
||||
* @return
|
||||
* @throws ModbusTransportException
|
||||
* @throws ErrorResponseException
|
||||
*/
|
||||
public static Boolean readInputStatus(int slaveId, int offset,String ip ,int prot)
|
||||
throws ModbusTransportException, ErrorResponseException {
|
||||
// 02 Input Status
|
||||
BaseLocator<Boolean> loc = BaseLocator.inputStatus(slaveId, offset);
|
||||
Boolean value = getMaster(ip, prot).getValue(loc);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 读取[03 Holding Register类型 4x]模拟量数据
|
||||
*
|
||||
* @param slaveId
|
||||
* slave Id
|
||||
* @param offset
|
||||
* 位置
|
||||
* @param dataType
|
||||
* 数据类型,来自com.serotonin.modbus4j.code.DataType
|
||||
* @return
|
||||
* @throws ModbusTransportException
|
||||
* 异常
|
||||
* @throws ErrorResponseException
|
||||
* 异常
|
||||
*/
|
||||
public static Number readHoldingRegister(int slaveId, int offset, int dataType,String ip ,int prot )
|
||||
throws ModbusTransportException, ErrorResponseException {
|
||||
// 03 Holding Register类型数据读取
|
||||
BaseLocator<Number> loc = BaseLocator.holdingRegister(slaveId, offset, dataType);
|
||||
Number value = getMaster(ip,prot).getValue(loc);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取[04 Input Registers 3x]类型 模拟量数据
|
||||
*
|
||||
* @param slaveId
|
||||
* slaveId
|
||||
* @param offset
|
||||
* 位置
|
||||
* @param dataType
|
||||
* 数据类型,来自com.serotonin.modbus4j.code.DataType
|
||||
* @return 返回结果
|
||||
* @throws ModbusTransportException
|
||||
* 异常
|
||||
* @throws ErrorResponseException
|
||||
* 异常
|
||||
*/
|
||||
public static Number readInputRegisters(int slaveId, int offset, int dataType ,String ip ,int prot)
|
||||
throws ModbusTransportException, ErrorResponseException {
|
||||
// 04 Input Registers类型数据读取
|
||||
BaseLocator<Number> loc = BaseLocator.inputRegister(slaveId, offset, dataType);
|
||||
Number value = getMaster(ip,prot).getValue(loc);
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量读取使用方法
|
||||
*
|
||||
* @throws ModbusTransportException
|
||||
* @throws ErrorResponseException
|
||||
*/
|
||||
public static void batchRead(String ip ,int prot ) throws ModbusTransportException, ErrorResponseException {
|
||||
|
||||
BatchRead<Integer> batch = new BatchRead<Integer>();
|
||||
|
||||
batch.addLocator(0, BaseLocator.holdingRegister(2, 1, DataType.FOUR_BYTE_FLOAT));
|
||||
batch.addLocator(1, BaseLocator.inputStatus(1, 0));
|
||||
|
||||
ModbusMaster master = getMaster(ip,prot);
|
||||
|
||||
batch.setContiguousRequests(false);
|
||||
BatchResults<Integer> results = master.send(batch);
|
||||
System.out.println(results.getValue(0));
|
||||
System.out.println(results.getValue(1));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 测试
|
||||
// *
|
||||
// * @param args
|
||||
// */
|
||||
// public static void main(String[] args) {
|
||||
// try {
|
||||
// // 01测试
|
||||
// Boolean v011 = readCoilStatus(1, 0);
|
||||
// Boolean v012 = readCoilStatus(1, 1);
|
||||
// Boolean v013 = readCoilStatus(1, 6);
|
||||
// System.out.println("v011:" + v011);
|
||||
// System.out.println("v012:" + v012);
|
||||
// System.out.println("v013:" + v013);
|
||||
// // 02测试
|
||||
// Boolean v021 = readInputStatus(1, 0);
|
||||
// Boolean v022 = readInputStatus(1, 1);
|
||||
// Boolean v023 = readInputStatus(1, 2);
|
||||
// System.out.println("v021:" + v021);
|
||||
// System.out.println("v022:" + v022);
|
||||
// System.out.println("v023:" + v023);
|
||||
//
|
||||
// // 03测试
|
||||
// Number v031 = readHoldingRegister(1, 1, DataType.FOUR_BYTE_FLOAT);// 注意,float
|
||||
// Number v032 = readHoldingRegister(1, 3, DataType.FOUR_BYTE_FLOAT);// 同上
|
||||
// System.out.println("v031:" + v031);
|
||||
// System.out.println("v032:" + v032);
|
||||
//
|
||||
// // 04测试
|
||||
// Number v041 = readInputRegisters(1, 1, DataType.FOUR_BYTE_FLOAT);//
|
||||
// Number v042 = readInputRegisters(1, 3, DataType.FOUR_BYTE_FLOAT);//
|
||||
// System.out.println("v041:" + v041);
|
||||
// System.out.println("v042:" + v042);
|
||||
// // 批量读取
|
||||
// batchRead();
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 写 [01 Coil Status(0x)]写一个 function ID = 5
|
||||
*
|
||||
* @param slaveId
|
||||
* slave的ID
|
||||
* @param writeOffset
|
||||
* 位置
|
||||
* @param writeValue
|
||||
* 值
|
||||
* @return 是否写入成功
|
||||
* @throws ModbusTransportException
|
||||
*/
|
||||
public static boolean writeCoil(int slaveId, int writeOffset, boolean writeValue ,String ip ,int prot)
|
||||
throws ModbusTransportException {
|
||||
// 获取master
|
||||
ModbusMaster tcpMaster = getMaster(ip, prot);
|
||||
// 创建请求
|
||||
WriteCoilRequest request = new WriteCoilRequest(slaveId, writeOffset, writeValue);
|
||||
// 发送请求并获取响应对象
|
||||
WriteCoilResponse response = (WriteCoilResponse) tcpMaster.send(request);
|
||||
if (response.isException()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写[01 Coil Status(0x)] 写多个 function ID = 15
|
||||
*
|
||||
* @param slaveId
|
||||
* slaveId
|
||||
* @param startOffset
|
||||
* 开始位置
|
||||
* @param bdata
|
||||
* 写入的数据
|
||||
* @return 是否写入成功
|
||||
* @throws ModbusTransportException
|
||||
*/
|
||||
public static boolean writeCoils(int slaveId, int startOffset, boolean[] bdata,String ip ,int prot)
|
||||
throws ModbusTransportException {
|
||||
// 获取master
|
||||
ModbusMaster tcpMaster = getMaster(ip, prot);
|
||||
// 创建请求
|
||||
WriteCoilsRequest request = new WriteCoilsRequest(slaveId, startOffset, bdata);
|
||||
// 发送请求并获取响应对象
|
||||
WriteCoilsResponse response = (WriteCoilsResponse) tcpMaster.send(request);
|
||||
if (response.isException()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
* 写[03 Holding Register(4x)] 写一个 function ID = 6
|
||||
*
|
||||
* @param slaveId 11
|
||||
* @param writeOffset
|
||||
* @param writeValue
|
||||
* @return
|
||||
* @throws ModbusTransportException
|
||||
*/
|
||||
public static boolean writeRegister(int slaveId, int writeOffset, int writeValue, String ip ,int prot)
|
||||
throws ModbusTransportException {
|
||||
// 获取master
|
||||
ModbusMaster tcpMaster = getMaster(ip, prot);
|
||||
// 创建请求对象
|
||||
WriteRegisterRequest request = new WriteRegisterRequest(slaveId, writeOffset, writeValue);
|
||||
WriteRegisterResponse response = (WriteRegisterResponse) tcpMaster.send(request);
|
||||
System.out.println("我这都是什么值:"+response);
|
||||
if (response.isException()) {
|
||||
System.out.println("我错哪了?"+response.getExceptionMessage());
|
||||
// log.error(response.getExceptionMessage());
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写多个量
|
||||
* 写入[03 Holding Register(4x)]写多个 function ID=16
|
||||
* @param slaveId
|
||||
* @param startOffset 起始位置偏移量值
|
||||
* @param sdata 写入的数据
|
||||
*/
|
||||
public static boolean writeRegisters(int slaveId, int startOffset, short[] sdata, String ip ,int prot)
|
||||
throws ModbusTransportException {
|
||||
// 获取master
|
||||
ModbusMaster tcpMaster = getMaster(ip, prot);
|
||||
// 创建请求对象
|
||||
WriteRegistersRequest request = new WriteRegistersRequest(slaveId, startOffset, sdata);
|
||||
// 发送请求并获取响应对象
|
||||
ModbusResponse response = tcpMaster.send(request);
|
||||
if (response.isException()) {
|
||||
log.error(response.getExceptionMessage());
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* rtu写数据
|
||||
* @param slaveId 从站ID
|
||||
* @param writeOffset 偏移
|
||||
* @param writeValue 写入值
|
||||
* @return
|
||||
* @throws ModbusTransportException
|
||||
*/
|
||||
public static boolean writeRegisterRtu(int slaveId, int writeOffset, int writeValue)
|
||||
throws ModbusTransportException {
|
||||
// 获取master
|
||||
ModbusMaster rtuMaster = getSerialPortRtuMaster();
|
||||
// 创建请求对象
|
||||
WriteRegisterRequest request = new WriteRegisterRequest(slaveId, writeOffset, writeValue);
|
||||
WriteRegisterResponse response = (WriteRegisterResponse) rtuMaster.send(request);
|
||||
if (response.isException()) {
|
||||
// log.error(response.getExceptionMessage());
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入数字类型的模拟量(如:写入Float类型的模拟量、Double类型模拟量、整数类型Short、Integer、Long)
|
||||
*
|
||||
* @param slaveId
|
||||
* @param offset
|
||||
* @param value
|
||||
* 写入值,Number的子类,例如写入Float浮点类型,Double双精度类型,以及整型short,int,long
|
||||
* ,com.serotonin.modbus4j.code.DataType
|
||||
* @throws ModbusTransportException
|
||||
* @throws ErrorResponseException
|
||||
*/
|
||||
public static void writeHoldingRegister(int slaveId, int offset, Number value, int dataType,String ip ,int prot)
|
||||
throws ModbusTransportException, ErrorResponseException {
|
||||
// 获取master
|
||||
ModbusMaster tcpMaster = getMaster(ip, prot);
|
||||
// 类型
|
||||
BaseLocator<Number> locator = BaseLocator.holdingRegister(slaveId, offset, dataType);
|
||||
tcpMaster.setMultipleWritesOnly(true);
|
||||
tcpMaster.setValue(locator, value);
|
||||
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// try {
|
||||
//@formatter:off
|
||||
// 测试01
|
||||
// boolean t01 = writeCoil(1, 0, true);
|
||||
// System.out.println("T01:" + t01);
|
||||
|
||||
// 测试02
|
||||
// boolean t02 = writeCoils(1, 0, new boolean[] { true, false, true });
|
||||
// System.out.println("T02:" + t02);
|
||||
|
||||
// 测试03
|
||||
// short v = -3;
|
||||
// boolean t03 = writeRegister(1, 0, v);
|
||||
// System.out.println("T03:" + t03);
|
||||
// 测试04
|
||||
// boolean t04 = writeRegisters(1, 0, new short[] { -3, 3, 9 });
|
||||
// System.out.println("t04:" + t04);
|
||||
//写模拟量
|
||||
// writeHoldingRegister(1,0, 10.1f, DataType.FOUR_BYTE_FLOAT);
|
||||
|
||||
//@formatter:on
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
*short数组转byte
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static byte [] shorts2Bytes(short [] data){
|
||||
byte[] byteValue = new byte[data.length * 2];
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
byteValue[i * 2] = (byte) (data[i] & 0xff);
|
||||
byteValue[i * 2 + 1] = (byte) ((data[i] & 0xff00) >> 8);
|
||||
}
|
||||
return byteValue;
|
||||
}
|
||||
/**
|
||||
* Byte数组转short数组
|
||||
*
|
||||
* @param bytes
|
||||
* @return
|
||||
*/
|
||||
public static short[] bytesToShort(byte[] bytes) {
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
}
|
||||
short[] shorts = new short[bytes.length / 2];
|
||||
ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().get(shorts);
|
||||
return shorts;
|
||||
|
||||
}
|
||||
|
||||
//大端转换小端
|
||||
public static float littleEndianSwap(float big) {
|
||||
|
||||
int fbit = Float.floatToIntBits(big);
|
||||
int a = fbit << 16;
|
||||
a &= 0xFFFF0000;
|
||||
System.out.println("a:"+ a);
|
||||
|
||||
int b = fbit >> 16;
|
||||
b &= 0xFFFF;
|
||||
System.out.println("b:"+ b);
|
||||
|
||||
int l;
|
||||
l = a|b;
|
||||
System.out.println("l:"+l);
|
||||
|
||||
float little = Float.intBitsToFloat(l);
|
||||
return little;
|
||||
}
|
||||
|
||||
//方法1:
|
||||
//(3412) 小端交换字节模式
|
||||
public static float big2Little(float big){
|
||||
// 把float转换为byte[]
|
||||
int fbit = Float.floatToIntBits(big);
|
||||
System.out.println("+========1======="+fbit);
|
||||
byte[] b = new byte[4];
|
||||
b[0] = (byte) (fbit >> 16);
|
||||
b[1] = (byte) (fbit);
|
||||
|
||||
int l;
|
||||
l = b[0];
|
||||
l &= 0xff;
|
||||
l |= ((long) b[2] << 16);
|
||||
float little = Float.intBitsToFloat(l);
|
||||
return little;
|
||||
}
|
||||
|
||||
//方法2:
|
||||
public static float big2Little2(float big){
|
||||
|
||||
// 把float转换为byte[]
|
||||
int fbit = Float.floatToIntBits(big);
|
||||
System.out.println("+=======2========"+fbit);
|
||||
int a = fbit << 16;
|
||||
a &= 0xFFFF0000;
|
||||
System.out.println("a:"+ a);
|
||||
|
||||
int b = fbit >> 16;
|
||||
|
||||
b &= 0xFFFF;
|
||||
System.out.println("b:"+ b);
|
||||
|
||||
int l;
|
||||
l = a|b;
|
||||
|
||||
System.out.println("l:"+l);
|
||||
|
||||
float little = Float.intBitsToFloat(l);
|
||||
return little;
|
||||
}
|
||||
|
||||
//大端(1234)转小端(4321)
|
||||
public static float big2Little3(float big){
|
||||
// 把float转换为byte[]
|
||||
int fbit = Float.floatToIntBits(big);
|
||||
System.out.println("+========1======="+Integer.toBinaryString(fbit));
|
||||
|
||||
byte[] b = new byte[4];
|
||||
b[0] = (byte) (fbit >> 24);
|
||||
b[1] = (byte) (fbit >> 16);
|
||||
b[2] = (byte) (fbit >> 8);
|
||||
b[3] = (byte) (fbit);
|
||||
//以下换位置没有看懂,jiang
|
||||
|
||||
int l;
|
||||
l = b[0];
|
||||
System.out.println("+========6======="+Integer.toBinaryString(l));
|
||||
l &= 0xff;
|
||||
System.out.println("--------1-------"+l);
|
||||
l |= ((long) b[1] << 8);
|
||||
System.out.println("--------2-------"+(long) b[1]);
|
||||
System.out.println("+========8======="+Integer.toBinaryString(l));
|
||||
l &= 0xffff;
|
||||
System.out.println("--------3-------"+l);
|
||||
System.out.println("+========9======="+Integer.toBinaryString(l));
|
||||
|
||||
|
||||
l |= ((long) b[2] << 16);
|
||||
System.out.println("--------4-------"+(long) b[2]);
|
||||
System.out.println("+========10======="+Integer.toBinaryString(l));
|
||||
l &= 0xffffff;
|
||||
System.out.println("--------5-------"+l);
|
||||
System.out.println("+========11======="+Integer.toBinaryString(l));
|
||||
l |= ((long) b[3] << 24);
|
||||
System.out.println("--------6-------"+(long) b[3]);
|
||||
System.out.println("+========12======="+Integer.toBinaryString(l));
|
||||
float little = Float.intBitsToFloat(l);
|
||||
return little;
|
||||
}
|
||||
|
||||
/**
|
||||
* 大端(1234)转大端交换(2143)
|
||||
* 把咱们能看懂的数字转成相对应的模式
|
||||
* 在modbuspoll上咱们能看懂的数字是大端交换模式。
|
||||
* 该方法按照modbuspoll上的解释应该是 大端交换模式转大端模式
|
||||
* @param big
|
||||
* @return
|
||||
*/
|
||||
public static float big2bigsw(float big){
|
||||
|
||||
// 把float转换为byte[]
|
||||
int fbit = Float.floatToIntBits(big);
|
||||
byte[] b = new byte[4];
|
||||
b[0] = (byte) (fbit >> 24);
|
||||
b[1] = (byte) (fbit >> 16);
|
||||
b[2] = (byte) (fbit >> 8);
|
||||
b[3] = (byte) (fbit);
|
||||
// byte[] c = new byte[4];
|
||||
// c[0] = b[1];
|
||||
// c[1] = b[0];
|
||||
// c[2] = b[3];
|
||||
// c[3] = b[2];
|
||||
|
||||
//把b[1]放到b[0]前面
|
||||
int f;
|
||||
f = b[2]; //赋予初始值b[2]
|
||||
f &= 0xff; //保留最后8位二进制,即保留b[2]使其置于最后
|
||||
f |= ((long) b[3] << 8); //把b[3]向左位移8位即在b[2]之前
|
||||
f &= 0xffff;//保留最后16位二进制,即按b[3]b[2]的顺序存储
|
||||
f|=((long)b[0]<<16);//把b[0]向左位移16位即在b[3]之前
|
||||
f &= 0xffffff;//保留最后24位,即按b[0]b[3]b[2]的顺序存储
|
||||
f|=((long)b[1]<<24);//b[1]向左位移24位即在b[0]之前
|
||||
f &= 0xffffffff;//保留最后32位,即按b[1]b[0]b[3]b[2]的顺序存储
|
||||
float floatValue = Float.intBitsToFloat(f);
|
||||
System.out.println("----1--"+floatValue);
|
||||
return floatValue;
|
||||
}
|
||||
|
||||
public static float toLittleEndian(float value) {
|
||||
ByteBuffer buffer = ByteBuffer.allocate(4); // Allocate 4 bytes for a float
|
||||
buffer.order(ByteOrder.BIG_ENDIAN); // Set the byte order to big-endian
|
||||
buffer.putFloat(value); // Put the float value into the buffer
|
||||
|
||||
ByteBuffer buffer2 = ByteBuffer.allocate(4); // Allocate 4 bytes for a float
|
||||
buffer2.order(ByteOrder.LITTLE_ENDIAN); // Set the byte order to little-endian
|
||||
buffer2.putInt(buffer.getInt()); // Get the big-endian integer value and put it into the little-endian buffer
|
||||
|
||||
return buffer2.getFloat(); // Get the float value from the little-endian buffer
|
||||
}
|
||||
|
||||
public static float toBigEndian(float value) {
|
||||
ByteBuffer buffer = ByteBuffer.allocate(4); // Allocate 4 bytes for a float
|
||||
buffer.order(ByteOrder.LITTLE_ENDIAN); // Set the byte order to little-endian
|
||||
buffer.putFloat(value); // Put the float value into the buffer
|
||||
|
||||
ByteBuffer buffer2 = ByteBuffer.allocate(4); // Allocate 4 bytes for a float
|
||||
buffer2.order(ByteOrder.BIG_ENDIAN); // Set the byte order to big-endian
|
||||
buffer2.putInt(buffer.getInt()); // Get the little-endian integer value and put it into the big-endian buffer
|
||||
|
||||
return buffer2.getFloat(); // Get the float value from the big-endian buffer
|
||||
}
|
||||
|
||||
public static float toBigEndianSwapped(float value) {
|
||||
ByteBuffer buffer = ByteBuffer.allocate(4); // Allocate 4 bytes for a float
|
||||
buffer.order(ByteOrder.BIG_ENDIAN); // Set the byte order to big-endian
|
||||
buffer.putFloat(value); // Put the float value into the buffer
|
||||
|
||||
ByteBuffer buffer2 = ByteBuffer.allocate(4); // Allocate 4 bytes for a float
|
||||
buffer2.order(ByteOrder.BIG_ENDIAN); // Set the byte order to big-endian
|
||||
buffer2.putFloat(buffer.getFloat()); // Get the big-endian integer value and put it into the big-endian buffer
|
||||
System.out.println("----2--"+buffer2.getFloat());
|
||||
return buffer2.getFloat(); // Get the float value from the big-endian buffer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
1035
src/main/java/org/gyk/modules/sssj/controller/GykController.java
Normal file
1035
src/main/java/org/gyk/modules/sssj/controller/GykController.java
Normal file
File diff suppressed because it is too large
Load Diff
34
src/main/java/org/gyk/modules/sssj/entity/BiaoTi.java
Normal file
34
src/main/java/org/gyk/modules/sssj/entity/BiaoTi.java
Normal file
@ -0,0 +1,34 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class BiaoTi implements Serializable {
|
||||
|
||||
private String title;
|
||||
private String align;//站场
|
||||
private String dataIndex;//区
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getAlign() {
|
||||
return align;
|
||||
}
|
||||
|
||||
public void setAlign(String align) {
|
||||
this.align = align;
|
||||
}
|
||||
|
||||
public String getDataIndex() {
|
||||
return dataIndex;
|
||||
}
|
||||
|
||||
public void setDataIndex(String dataIndex) {
|
||||
this.dataIndex = dataIndex;
|
||||
}
|
||||
}
|
52
src/main/java/org/gyk/modules/sssj/entity/BjxxCal.java
Normal file
52
src/main/java/org/gyk/modules/sssj/entity/BjxxCal.java
Normal file
@ -0,0 +1,52 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
import net.sf.jsqlparser.expression.DateTimeLiteralExpression;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class BjxxCal implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String bjID; //报警ID 工业库标志
|
||||
private int bjTimes; //报警次数
|
||||
private Date lastBjTime; //上次报警时间
|
||||
private int jlbz; //记录标志 a
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getBjID() {
|
||||
return bjID;
|
||||
}
|
||||
|
||||
public void setBjID(String bjID) {
|
||||
this.bjID = bjID;
|
||||
}
|
||||
|
||||
public int getBjTimes() {
|
||||
return bjTimes;
|
||||
}
|
||||
|
||||
public void setBjTimes(int bjTimes) {
|
||||
this.bjTimes = bjTimes;
|
||||
}
|
||||
|
||||
public Date getLastBjTime() {
|
||||
return lastBjTime;
|
||||
}
|
||||
|
||||
public void setLastBjTime(Date lastBjTime) {
|
||||
this.lastBjTime = lastBjTime;
|
||||
}
|
||||
//
|
||||
public int getJlbz() {
|
||||
return jlbz;
|
||||
}
|
||||
|
||||
public void setJlbz(int Jlbz) {
|
||||
this.jlbz = jlbz;
|
||||
}
|
||||
}
|
110
src/main/java/org/gyk/modules/sssj/entity/CxcQijingRB.java
Normal file
110
src/main/java/org/gyk/modules/sssj/entity/CxcQijingRB.java
Normal file
@ -0,0 +1,110 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 气井日报
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-09-01
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cxc_rsj_qijingrb")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cxc_rsj_qijingrb对象", description="气井日报")
|
||||
public class CxcQijingRB implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd ")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date createTime;
|
||||
/**管理单位*/
|
||||
@Excel(name = "管理单位", width = 15)
|
||||
@ApiModelProperty(value = "管理单位")
|
||||
private String departName;
|
||||
/**所属站点*/
|
||||
@Excel(name = "所属站点", width = 15)
|
||||
@ApiModelProperty(value = "所属站点")
|
||||
private String stationName;
|
||||
/**井号*/
|
||||
@Excel(name = "井号", width = 15)
|
||||
@ApiModelProperty(value = "井号")
|
||||
private String jh;
|
||||
/**生产时间*/
|
||||
@Excel(name = "生产时间", width = 15)
|
||||
@ApiModelProperty(value = "生产时间")
|
||||
private String scsj;
|
||||
/**生产油压(MPa)*/
|
||||
@Excel(name = "生产油压(MPa)", width = 15)
|
||||
@ApiModelProperty(value = "生产油压(MPa)")
|
||||
private String scyy;
|
||||
/**生产套压(MPa)*/
|
||||
@Excel(name = "生产套压(MPa)", width = 15)
|
||||
@ApiModelProperty(value = "生产套压(MPa)")
|
||||
private String scty;
|
||||
/**日产气量(万方)*/
|
||||
@Excel(name = "日产气量(万方)", width = 15)
|
||||
@ApiModelProperty(value = "日产气量(万方)")
|
||||
private String cqdr;
|
||||
/**井口气量(万方)*/
|
||||
@Excel(name = "井口气量(万方)", width = 15)
|
||||
@ApiModelProperty(value = "井口气量(万方)")
|
||||
private String jkql;
|
||||
/**日产油量(方)*/
|
||||
@Excel(name = "日产油量(方)", width = 15)
|
||||
@ApiModelProperty(value = "日产油量(方)")
|
||||
private String yldr;
|
||||
/**日产水量(方)*/
|
||||
@Excel(name = "日产水量(方)", width = 15)
|
||||
@ApiModelProperty(value = "日产水量(方)")
|
||||
private String sldr;
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String bz;
|
||||
/**开井时间月累*/
|
||||
@ApiModelProperty(value = "开井时间月累")
|
||||
private Double kjsjyl;
|
||||
/**开井时间年累*/
|
||||
@ApiModelProperty(value = "开井时间年累")
|
||||
private Double kjsjnl;
|
||||
/**气量月累*/
|
||||
@ApiModelProperty(value = "气量月累")
|
||||
private Double qlyl;
|
||||
/**气量年累*/
|
||||
@ApiModelProperty(value = "气量年累")
|
||||
private Double qlnl;
|
||||
/**油量月累*/
|
||||
@ApiModelProperty(value = "油量月累")
|
||||
private Double ylyl;
|
||||
/**油量年累*/
|
||||
@ApiModelProperty(value = "油量年累")
|
||||
private Double ylnl;
|
||||
/**水量月累*/
|
||||
@ApiModelProperty(value = "水量月累")
|
||||
private Double slyl;
|
||||
/**水量年累*/
|
||||
@ApiModelProperty(value = "水量年累")
|
||||
private Double slnl;
|
||||
|
||||
}
|
97
src/main/java/org/gyk/modules/sssj/entity/CxcRsjQijing.java
Normal file
97
src/main/java/org/gyk/modules/sssj/entity/CxcRsjQijing.java
Normal file
@ -0,0 +1,97 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 气井日数据
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2021-09-01
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("cxc_rsj_qijing")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="cxc_rsj_qijing对象", description="气井日数据")
|
||||
public class CxcRsjQijing implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**管理单位*/
|
||||
@ApiModelProperty(value = "管理单位")
|
||||
private java.lang.String departName;
|
||||
/**所属站点*/
|
||||
@ApiModelProperty(value = "所属站点")
|
||||
private java.lang.String stationName;
|
||||
/**井号*/
|
||||
@ApiModelProperty(value = "井号")
|
||||
private java.lang.String jh;
|
||||
/**生产日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "生产日期")
|
||||
private java.util.Date createTime;
|
||||
/**生产时间*/
|
||||
@ApiModelProperty(value = "生产时间")
|
||||
private java.lang.String scsj;
|
||||
/**生产制度*/
|
||||
@ApiModelProperty(value = "生产制度")
|
||||
private java.lang.String sczd;
|
||||
/**生产油压(MPa)*/
|
||||
@ApiModelProperty(value = "生产油压(MPa)")
|
||||
private java.lang.String scyy;
|
||||
/**生产套压(MPa)*/
|
||||
@ApiModelProperty(value = "生产套压(MPa)")
|
||||
private java.lang.String scty;
|
||||
/**日产气量(万方)*/
|
||||
@ApiModelProperty(value = "日产气量(万方)")
|
||||
private java.lang.String rcql;
|
||||
/**井口系数*/
|
||||
@ApiModelProperty(value = "井口系数")
|
||||
private java.lang.String jkxs;
|
||||
/**井口气量(万方)*/
|
||||
@ApiModelProperty(value = "井口气量(万方)")
|
||||
private java.lang.String jkql;
|
||||
/**日产油量(方)*/
|
||||
@ApiModelProperty(value = "日产油量(方)")
|
||||
private java.lang.String rcyl;
|
||||
/**日产水量(方)*/
|
||||
@ApiModelProperty(value = "日产水量(方)")
|
||||
private java.lang.String rcsl;
|
||||
/**压力类别*/
|
||||
@ApiModelProperty(value = "压力类别")
|
||||
private java.lang.String yllb;
|
||||
/**备注*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private java.lang.String bz;
|
||||
private java.lang.String jingh;
|
||||
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
public class GykDataProperties {
|
||||
private String TagName; //变量名称
|
||||
private Integer TagId; //变量ID
|
||||
private String Qu;
|
||||
private String Zhan;
|
||||
private String JldName; //计量点名称
|
||||
private String value;
|
||||
private String JldDw;//工艺单位
|
||||
|
||||
|
||||
public GykDataProperties(String TagName, Integer TagId, String Qu, String Zhan, String JldName, String JldDw) {
|
||||
this.TagName = TagName;
|
||||
this.TagId = TagId;
|
||||
this.Qu = Qu;
|
||||
this.Zhan = Zhan;
|
||||
this.JldName = JldName;
|
||||
this.JldDw = JldDw;
|
||||
}
|
||||
|
||||
public String getJldDw() {
|
||||
return JldDw;
|
||||
}
|
||||
|
||||
public void setJldDw(String jldDw) {
|
||||
JldDw = jldDw;
|
||||
}
|
||||
|
||||
public Integer getTagId() {
|
||||
return TagId;
|
||||
}
|
||||
|
||||
public void setTagId(Integer tagId) {
|
||||
TagId = tagId;
|
||||
}
|
||||
|
||||
public String getTagName() {
|
||||
return this.TagName;
|
||||
}
|
||||
|
||||
public void setTagName(String TagName) {
|
||||
this.TagName = TagName;
|
||||
}
|
||||
|
||||
public String getQu() {
|
||||
return this.Qu;
|
||||
}
|
||||
|
||||
public void setQu(String Qu) {
|
||||
this.Qu = Qu;
|
||||
}
|
||||
|
||||
public String getZhan() {
|
||||
return this.Zhan;
|
||||
}
|
||||
|
||||
public void setZhan(String Zhan) {
|
||||
this.Zhan = Zhan;
|
||||
}
|
||||
|
||||
public String getJldName() {
|
||||
return this.JldName;
|
||||
}
|
||||
|
||||
public void setJldName(String JldName) {
|
||||
this.JldName = JldName;
|
||||
}
|
||||
|
||||
public String getvalue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public void setvalue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
276
src/main/java/org/gyk/modules/sssj/entity/JldData.java
Normal file
276
src/main/java/org/gyk/modules/sssj/entity/JldData.java
Normal file
@ -0,0 +1,276 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
public class JldData {
|
||||
private String id;
|
||||
private String jldname; //计量点名称
|
||||
|
||||
private String zhan;
|
||||
private String station_id;
|
||||
private String depart_id;
|
||||
private String qu;
|
||||
private String wd;//温度
|
||||
private String yl;//压力
|
||||
private String yc;//压差
|
||||
private String ssll;//瞬时流量
|
||||
private String jrl;//今日量
|
||||
private String syll;//上月流量
|
||||
private String byll;//本月流量
|
||||
private String zll;//总流量(累积量)
|
||||
private String jrsj;//今日时间
|
||||
private String yxzt;//运行状态
|
||||
private String bz;//备注
|
||||
private String bjzt;
|
||||
|
||||
private String zrsj;//昨日时间
|
||||
private String zrl;//昨日量
|
||||
private String gykbz;//工业库标识
|
||||
private String jlddw;//单位
|
||||
private String krvalue;//可燃数值
|
||||
private String gyvalue;//工艺参数
|
||||
private String ysvalue;//压缩机参数
|
||||
private String krzt;//可燃状态
|
||||
private String ngvalue;//可燃状态
|
||||
|
||||
private String jczlx; //新增 进出站类型 by 闵
|
||||
|
||||
private String sqDw; //新增 输差dw配置 by 闵
|
||||
|
||||
public String getSqDw() {
|
||||
return sqDw;
|
||||
}
|
||||
|
||||
public void setSqDw(String sqDw) {
|
||||
this.sqDw = sqDw;
|
||||
}
|
||||
|
||||
public String getJczlx() {
|
||||
return jczlx;
|
||||
}
|
||||
|
||||
public void setJczlx(String jczlx) {
|
||||
this.jczlx = jczlx;
|
||||
}
|
||||
|
||||
public String getNgvalue() {
|
||||
return ngvalue;
|
||||
}
|
||||
|
||||
public void setNgvalue(String ngvalue) {
|
||||
this.ngvalue = ngvalue;
|
||||
}
|
||||
public String getYsvalue() {
|
||||
return ysvalue;
|
||||
}
|
||||
|
||||
public void setYsvalue(String ysvalue) {
|
||||
this.ysvalue = ysvalue;
|
||||
}
|
||||
|
||||
public String getKrzt() {
|
||||
return krzt;
|
||||
}
|
||||
|
||||
public void setKrzt(String krzt) {
|
||||
this.krzt = krzt;
|
||||
}
|
||||
|
||||
public String getKrvalue() {
|
||||
return krvalue;
|
||||
}
|
||||
|
||||
public void setKrvalue(String krvalue) {
|
||||
this.krvalue = krvalue;
|
||||
}
|
||||
|
||||
public String getGyvalue() {
|
||||
return gyvalue;
|
||||
}
|
||||
|
||||
public void setGyvalue(String gyvalue) {
|
||||
this.gyvalue = gyvalue;
|
||||
}
|
||||
|
||||
public JldData() {
|
||||
}
|
||||
|
||||
public String getJlddw() {
|
||||
return jlddw;
|
||||
}
|
||||
|
||||
public void setJlddw(String jlddw) {
|
||||
this.jlddw = jlddw;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStation_id() {
|
||||
return station_id;
|
||||
}
|
||||
|
||||
public void setStation_id(String station_id) {
|
||||
this.station_id = station_id;
|
||||
}
|
||||
|
||||
public String getDepart_id() {
|
||||
return depart_id;
|
||||
}
|
||||
|
||||
public void setDepart_id(String depart_id) {
|
||||
this.depart_id = depart_id;
|
||||
}
|
||||
|
||||
public String getGykbz() {
|
||||
return gykbz;
|
||||
}
|
||||
|
||||
public void setGykbz(String gykbz) {
|
||||
this.gykbz = gykbz;
|
||||
}
|
||||
|
||||
public String getQu() {
|
||||
return qu;
|
||||
}
|
||||
|
||||
public void setQu(String qu) {
|
||||
this.qu = qu;
|
||||
}
|
||||
|
||||
public String getWd() {
|
||||
return wd;
|
||||
}
|
||||
|
||||
public void setWd(String wd) {
|
||||
this.wd = wd;
|
||||
}
|
||||
|
||||
public String getYl() {
|
||||
return yl;
|
||||
}
|
||||
|
||||
public void setYl(String yl) {
|
||||
this.yl = yl;
|
||||
}
|
||||
|
||||
public String getYc() {
|
||||
return yc;
|
||||
}
|
||||
|
||||
public void setYc(String yc) {
|
||||
this.yc = yc;
|
||||
}
|
||||
|
||||
public String getSsll() {
|
||||
return ssll;
|
||||
}
|
||||
|
||||
public void setSsll(String ssll) {
|
||||
this.ssll = ssll;
|
||||
}
|
||||
|
||||
public String getJrl() {
|
||||
return jrl;
|
||||
}
|
||||
|
||||
public void setJrl(String jrl) {
|
||||
this.jrl = jrl;
|
||||
}
|
||||
|
||||
public String getByll() {
|
||||
return byll;
|
||||
}
|
||||
|
||||
public void setByll(String byll) {
|
||||
this.byll = byll;
|
||||
}
|
||||
|
||||
public String getZll() {
|
||||
return zll;
|
||||
}
|
||||
|
||||
public void setZll(String zll) {
|
||||
this.zll = zll;
|
||||
}
|
||||
|
||||
public String getJrsj() {
|
||||
return jrsj;
|
||||
}
|
||||
|
||||
public void setJrsj(String jrsj) {
|
||||
this.jrsj = jrsj;
|
||||
}
|
||||
|
||||
public String getBz() {
|
||||
return bz;
|
||||
}
|
||||
|
||||
public void setBz(String bz) {
|
||||
this.bz = bz;
|
||||
}
|
||||
|
||||
public String getZrsj() {
|
||||
return zrsj;
|
||||
}
|
||||
|
||||
public void setZrsj(String zrsj) {
|
||||
this.zrsj = zrsj;
|
||||
}
|
||||
|
||||
public String getZrl() {
|
||||
return zrl;
|
||||
}
|
||||
|
||||
public void setZrl(String zrl) {
|
||||
this.zrl = zrl;
|
||||
}
|
||||
|
||||
public String getYxzt() {
|
||||
return yxzt;
|
||||
}
|
||||
|
||||
public void setYxzt(String yxzt) {
|
||||
this.yxzt = yxzt;
|
||||
}
|
||||
|
||||
public String getJldname() {
|
||||
return this.jldname;
|
||||
}
|
||||
|
||||
public void setJldname(String jldname) {
|
||||
this.jldname = jldname;
|
||||
}
|
||||
|
||||
public String getZhan() {
|
||||
return this.zhan;
|
||||
}
|
||||
|
||||
public void setZhan(String zhan) {
|
||||
this.zhan = zhan;
|
||||
}
|
||||
|
||||
public String getSyll() {
|
||||
return this.syll;
|
||||
}
|
||||
|
||||
public void setSyll(String syll) {
|
||||
this.syll = syll;
|
||||
}
|
||||
|
||||
public String getBjzt() {
|
||||
return bjzt;
|
||||
}
|
||||
|
||||
public void setBjzt(String bjzt) {
|
||||
this.bjzt = bjzt;
|
||||
}
|
||||
|
||||
public String getstring() {
|
||||
String res = " jldname:" + jldname + " zhan:" + zhan + " ssl:" + ssll + " syll:" + syll;
|
||||
return res;
|
||||
}
|
||||
}
|
310
src/main/java/org/gyk/modules/sssj/entity/JldPar.java
Normal file
310
src/main/java/org/gyk/modules/sssj/entity/JldPar.java
Normal file
@ -0,0 +1,310 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
public class JldPar {
|
||||
private String JLD_ID ; //计量点ID
|
||||
private String JLD_NO ; //计量点编号
|
||||
private String JLD_NAME ; //计量点名称
|
||||
private String ReadTime ; //读取时间
|
||||
private String CH4 ;
|
||||
private String N2 ;
|
||||
private String CO2 ;
|
||||
private String C2H6 ;
|
||||
private String C3H8 ;
|
||||
private String H2O ;
|
||||
private String H2S ;
|
||||
private String H2 ;
|
||||
private String CO ;
|
||||
private String O2 ;
|
||||
private String i_C4H10 ;
|
||||
private String n_C4H10 ;
|
||||
private String i_C5H12 ;
|
||||
private String n_C5H12 ;
|
||||
private String n_C6H14 ;
|
||||
private String n_C7H16 ;
|
||||
private String n_C8H18 ;
|
||||
private String n_C9H20 ;
|
||||
private String n_C10H22 ;
|
||||
private String He ;
|
||||
private String Ar ;
|
||||
private String bak ;
|
||||
private String GJ ; //管径
|
||||
private String KJ ; //孔径
|
||||
private String Gr ; //相对密度
|
||||
private String DLND ; //动力粘度
|
||||
private String DSZS ; //等熵指数
|
||||
private String BAK1 ;
|
||||
private String BAK2 ;
|
||||
private String BAK3 ;
|
||||
|
||||
public String getJLD_ID() {
|
||||
return JLD_ID;
|
||||
}
|
||||
|
||||
public void setJLD_ID(String JLD_ID) {
|
||||
this.JLD_ID = JLD_ID;
|
||||
}
|
||||
|
||||
public String getJLD_NO() {
|
||||
return JLD_NO;
|
||||
}
|
||||
|
||||
public void setJLD_NO(String JLD_NO) {
|
||||
this.JLD_NO = JLD_NO;
|
||||
}
|
||||
|
||||
public String getJLD_NAME() {
|
||||
return JLD_NAME;
|
||||
}
|
||||
|
||||
public void setJLD_NAME(String JLD_NAME) {
|
||||
this.JLD_NAME = JLD_NAME;
|
||||
}
|
||||
|
||||
public String getReadTime() {
|
||||
return ReadTime;
|
||||
}
|
||||
|
||||
public void setReadTime(String readTime) {
|
||||
ReadTime = readTime;
|
||||
}
|
||||
|
||||
public String getCH4() {
|
||||
return CH4;
|
||||
}
|
||||
|
||||
public void setCH4(String CH4) {
|
||||
this.CH4 = CH4;
|
||||
}
|
||||
|
||||
public String getN2() {
|
||||
return N2;
|
||||
}
|
||||
|
||||
public void setN2(String n2) {
|
||||
N2 = n2;
|
||||
}
|
||||
|
||||
public String getCO2() {
|
||||
return CO2;
|
||||
}
|
||||
|
||||
public void setCO2(String CO2) {
|
||||
this.CO2 = CO2;
|
||||
}
|
||||
|
||||
public String getC2H6() {
|
||||
return C2H6;
|
||||
}
|
||||
|
||||
public void setC2H6(String c2H6) {
|
||||
C2H6 = c2H6;
|
||||
}
|
||||
|
||||
public String getC3H8() {
|
||||
return C3H8;
|
||||
}
|
||||
|
||||
public void setC3H8(String c3H8) {
|
||||
C3H8 = c3H8;
|
||||
}
|
||||
|
||||
public String getH2O() {
|
||||
return H2O;
|
||||
}
|
||||
|
||||
public void setH2O(String h2O) {
|
||||
H2O = h2O;
|
||||
}
|
||||
|
||||
public String getH2S() {
|
||||
return H2S;
|
||||
}
|
||||
|
||||
public void setH2S(String h2S) {
|
||||
H2S = h2S;
|
||||
}
|
||||
|
||||
public String getH2() {
|
||||
return H2;
|
||||
}
|
||||
|
||||
public void setH2(String h2) {
|
||||
H2 = h2;
|
||||
}
|
||||
|
||||
public String getCO() {
|
||||
return CO;
|
||||
}
|
||||
|
||||
public void setCO(String CO) {
|
||||
this.CO = CO;
|
||||
}
|
||||
|
||||
public String getO2() {
|
||||
return O2;
|
||||
}
|
||||
|
||||
public void setO2(String o2) {
|
||||
O2 = o2;
|
||||
}
|
||||
|
||||
public String getI_C4H10() {
|
||||
return i_C4H10;
|
||||
}
|
||||
|
||||
public void setI_C4H10(String i_C4H10) {
|
||||
this.i_C4H10 = i_C4H10;
|
||||
}
|
||||
|
||||
public String getN_C4H10() {
|
||||
return n_C4H10;
|
||||
}
|
||||
|
||||
public void setN_C4H10(String n_C4H10) {
|
||||
this.n_C4H10 = n_C4H10;
|
||||
}
|
||||
|
||||
public String getI_C5H12() {
|
||||
return i_C5H12;
|
||||
}
|
||||
|
||||
public void setI_C5H12(String i_C5H12) {
|
||||
this.i_C5H12 = i_C5H12;
|
||||
}
|
||||
|
||||
public String getN_C5H12() {
|
||||
return n_C5H12;
|
||||
}
|
||||
|
||||
public void setN_C5H12(String n_C5H12) {
|
||||
this.n_C5H12 = n_C5H12;
|
||||
}
|
||||
|
||||
public String getN_C6H14() {
|
||||
return n_C6H14;
|
||||
}
|
||||
|
||||
public void setN_C6H14(String n_C6H14) {
|
||||
this.n_C6H14 = n_C6H14;
|
||||
}
|
||||
|
||||
public String getN_C7H16() {
|
||||
return n_C7H16;
|
||||
}
|
||||
|
||||
public void setN_C7H16(String n_C7H16) {
|
||||
this.n_C7H16 = n_C7H16;
|
||||
}
|
||||
|
||||
public String getN_C8H18() {
|
||||
return n_C8H18;
|
||||
}
|
||||
|
||||
public void setN_C8H18(String n_C8H18) {
|
||||
this.n_C8H18 = n_C8H18;
|
||||
}
|
||||
|
||||
public String getN_C9H20() {
|
||||
return n_C9H20;
|
||||
}
|
||||
|
||||
public void setN_C9H20(String n_C9H20) {
|
||||
this.n_C9H20 = n_C9H20;
|
||||
}
|
||||
|
||||
public String getN_C10H22() {
|
||||
return n_C10H22;
|
||||
}
|
||||
|
||||
public void setN_C10H22(String n_C10H22) {
|
||||
this.n_C10H22 = n_C10H22;
|
||||
}
|
||||
|
||||
public String getHe() {
|
||||
return He;
|
||||
}
|
||||
|
||||
public void setHe(String he) {
|
||||
He = he;
|
||||
}
|
||||
|
||||
public String getAr() {
|
||||
return Ar;
|
||||
}
|
||||
|
||||
public void setAr(String ar) {
|
||||
Ar = ar;
|
||||
}
|
||||
|
||||
public String getBak() {
|
||||
return bak;
|
||||
}
|
||||
|
||||
public void setBak(String bak) {
|
||||
this.bak = bak;
|
||||
}
|
||||
|
||||
public String getGJ() {
|
||||
return GJ;
|
||||
}
|
||||
|
||||
public void setGJ(String GJ) {
|
||||
this.GJ = GJ;
|
||||
}
|
||||
|
||||
public String getKJ() {
|
||||
return KJ;
|
||||
}
|
||||
|
||||
public void setKJ(String KJ) {
|
||||
this.KJ = KJ;
|
||||
}
|
||||
|
||||
public String getGr() {
|
||||
return Gr;
|
||||
}
|
||||
|
||||
public void setGr(String gr) {
|
||||
Gr = gr;
|
||||
}
|
||||
|
||||
public String getDLND() {
|
||||
return DLND;
|
||||
}
|
||||
|
||||
public void setDLND(String DLND) {
|
||||
this.DLND = DLND;
|
||||
}
|
||||
|
||||
public String getDSZS() {
|
||||
return DSZS;
|
||||
}
|
||||
|
||||
public void setDSZS(String DSZS) {
|
||||
this.DSZS = DSZS;
|
||||
}
|
||||
|
||||
public String getBAK1() {
|
||||
return BAK1;
|
||||
}
|
||||
|
||||
public void setBAK1(String BAK1) {
|
||||
this.BAK1 = BAK1;
|
||||
}
|
||||
|
||||
public String getBAK2() {
|
||||
return BAK2;
|
||||
}
|
||||
|
||||
public void setBAK2(String BAK2) {
|
||||
this.BAK2 = BAK2;
|
||||
}
|
||||
|
||||
public String getBAK3() {
|
||||
return BAK3;
|
||||
}
|
||||
|
||||
public void setBAK3(String BAK3) {
|
||||
this.BAK3 = BAK3;
|
||||
}
|
||||
}
|
28
src/main/java/org/gyk/modules/sssj/entity/NgSssj.java
Normal file
28
src/main/java/org/gyk/modules/sssj/entity/NgSssj.java
Normal file
@ -0,0 +1,28 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("cxc_sssj_ngzx")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
public class NgSssj implements Serializable {
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
private String stationId;
|
||||
private String zhanName;
|
||||
private String jldName;
|
||||
private String gykbz;
|
||||
private String val;
|
||||
private String zt;
|
||||
private String acquisitionTime;
|
||||
|
||||
}
|
132
src/main/java/org/gyk/modules/sssj/entity/PianyuanZhan.java
Normal file
132
src/main/java/org/gyk/modules/sssj/entity/PianyuanZhan.java
Normal file
@ -0,0 +1,132 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class PianyuanZhan {
|
||||
private String id;
|
||||
private String jldname; //计量点名称
|
||||
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime rq;
|
||||
|
||||
private String wd;
|
||||
private String yali;
|
||||
|
||||
private String bkss;
|
||||
private String gkss;
|
||||
private String bkzl;
|
||||
private String gkzl;
|
||||
private String zrbklj;
|
||||
private String jrlj;
|
||||
|
||||
private String bkzl6;
|
||||
private String bkzl4;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getJldname() {
|
||||
return jldname;
|
||||
}
|
||||
|
||||
public void setJldname(String jldname) {
|
||||
this.jldname = jldname;
|
||||
}
|
||||
|
||||
public LocalDateTime getRq() {
|
||||
return rq;
|
||||
}
|
||||
|
||||
public void setRq(LocalDateTime rq) {
|
||||
this.rq = rq;
|
||||
}
|
||||
|
||||
public String getWd() {
|
||||
return wd;
|
||||
}
|
||||
|
||||
public void setWd(String wd) {
|
||||
this.wd = wd;
|
||||
}
|
||||
|
||||
public String getYali() {
|
||||
return yali;
|
||||
}
|
||||
|
||||
public void setYali(String yali) {
|
||||
this.yali = yali;
|
||||
}
|
||||
|
||||
public String getBkss() {
|
||||
return bkss;
|
||||
}
|
||||
|
||||
public void setBkss(String bkss) {
|
||||
this.bkss = bkss;
|
||||
}
|
||||
|
||||
public String getGkss() {
|
||||
return gkss;
|
||||
}
|
||||
|
||||
public void setGkss(String gkss) {
|
||||
this.gkss = gkss;
|
||||
}
|
||||
|
||||
public String getBkzl() {
|
||||
return bkzl;
|
||||
}
|
||||
|
||||
public void setBkzl(String bkzl) {
|
||||
this.bkzl = bkzl;
|
||||
}
|
||||
|
||||
public String getGkzl() {
|
||||
return gkzl;
|
||||
}
|
||||
|
||||
public void setGkzl(String gkzl) {
|
||||
this.gkzl = gkzl;
|
||||
}
|
||||
|
||||
public String getZrbklj() {
|
||||
return zrbklj;
|
||||
}
|
||||
|
||||
public void setZrbklj(String zrbklj) {
|
||||
this.zrbklj = zrbklj;
|
||||
}
|
||||
|
||||
public String getJrlj() {
|
||||
return jrlj;
|
||||
}
|
||||
|
||||
public void setJrlj(String jrlj) {
|
||||
this.jrlj = jrlj;
|
||||
}
|
||||
|
||||
public String getBkzl6() {
|
||||
return bkzl6;
|
||||
}
|
||||
|
||||
public void setBkzl6(String bkzl6) {
|
||||
this.bkzl6 = bkzl6;
|
||||
}
|
||||
|
||||
public String getBkzl4() {
|
||||
return bkzl4;
|
||||
}
|
||||
|
||||
public void setBkzl4(String bkzl4) {
|
||||
this.bkzl4 = bkzl4;
|
||||
}
|
||||
}
|
113
src/main/java/org/gyk/modules/sssj/entity/Rishuju.java
Normal file
113
src/main/java/org/gyk/modules/sssj/entity/Rishuju.java
Normal file
@ -0,0 +1,113 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class Rishuju {
|
||||
|
||||
/**主键*/
|
||||
private String id;
|
||||
|
||||
/**创建日期*/
|
||||
private Date createTime;
|
||||
|
||||
/**计量点ID*/
|
||||
private String jldId;
|
||||
|
||||
/**气量*/
|
||||
private String jrl;
|
||||
|
||||
/**计量点名称*/
|
||||
private String jldName;
|
||||
|
||||
/**今日气量*/
|
||||
private String jData;
|
||||
|
||||
/**年累计*/
|
||||
private String yData;
|
||||
|
||||
/**月累计*/
|
||||
private String mData;
|
||||
|
||||
/**管理单位*/
|
||||
private String danwei;
|
||||
|
||||
|
||||
|
||||
// public String getjData() {
|
||||
// return jData;
|
||||
// }
|
||||
//
|
||||
// public void setjData(String jData) {
|
||||
// this.jData = jData;
|
||||
// }
|
||||
//
|
||||
// public String getDanwei() {
|
||||
// return danwei;
|
||||
// }
|
||||
//
|
||||
// public void setDanwei(String danwei) {
|
||||
// this.danwei = danwei;
|
||||
// }
|
||||
//
|
||||
// public String getmData() {
|
||||
// return mData;
|
||||
// }
|
||||
//
|
||||
// public void setmData(String mData) {
|
||||
// this.mData = mData;
|
||||
// }
|
||||
//
|
||||
// public String getyData() {
|
||||
// return yData;
|
||||
// }
|
||||
//
|
||||
// public void setyData(String yData) {
|
||||
// this.yData = yData;
|
||||
// }
|
||||
//
|
||||
// public String getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public void setId(String id) {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public Date getCreateTime() {
|
||||
// return createTime;
|
||||
// }
|
||||
//
|
||||
// public void setCreateTime(Date createTime) {
|
||||
// this.createTime = createTime;
|
||||
// }
|
||||
//
|
||||
// public String getJldId() {
|
||||
// return jldId;
|
||||
// }
|
||||
//
|
||||
// public void setJldId(String jldId) {
|
||||
// this.jldId = jldId;
|
||||
// }
|
||||
//
|
||||
// public String getJrl() {
|
||||
// return jrl;
|
||||
// }
|
||||
//
|
||||
// public void setJrl(String jrl) {
|
||||
// this.jrl = jrl;
|
||||
// }
|
||||
//
|
||||
// public String getJldName() {
|
||||
// return jldName;
|
||||
// }
|
||||
//
|
||||
// public void setJldName(String jldName) {
|
||||
// this.jldName = jldName;
|
||||
// }
|
||||
}
|
33
src/main/java/org/gyk/modules/sssj/entity/YasuoLssjBt.java
Normal file
33
src/main/java/org/gyk/modules/sssj/entity/YasuoLssjBt.java
Normal file
@ -0,0 +1,33 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class YasuoLssjBt implements Serializable {
|
||||
private String bt;
|
||||
private String wz;
|
||||
private String zhi;
|
||||
|
||||
public String getBt() {
|
||||
return bt;
|
||||
}
|
||||
|
||||
public void setBt(String bt) {
|
||||
this.bt = bt;
|
||||
}
|
||||
|
||||
public String getWz() {
|
||||
return wz;
|
||||
}
|
||||
|
||||
public void setWz(String wz) {
|
||||
this.wz = wz;
|
||||
}
|
||||
|
||||
public String getZhi() {
|
||||
return zhi;
|
||||
}
|
||||
|
||||
public void setZhi(String zhi) {
|
||||
this.zhi = zhi;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class YasuojiBjCanshu implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String gykbz; //工业库标志
|
||||
|
||||
private Float baojingDi;//报警低值
|
||||
private Float baojingGao;//报警高值
|
||||
private Float tingjiDi;//停机低值
|
||||
private Float tingjiGao;//停机高值
|
||||
|
||||
public String getGykbz() {
|
||||
return gykbz;
|
||||
}
|
||||
|
||||
public void setGykbz(String gykbz) {
|
||||
this.gykbz = gykbz;
|
||||
}
|
||||
|
||||
public Float getBaojingDi() {
|
||||
return baojingDi;
|
||||
}
|
||||
|
||||
public void setBaojingDi(Float baojingDi) {
|
||||
this.baojingDi = baojingDi;
|
||||
}
|
||||
|
||||
public Float getBaojingGao() {
|
||||
return baojingGao;
|
||||
}
|
||||
|
||||
public void setBaojingGao(Float baojingGao) {
|
||||
this.baojingGao = baojingGao;
|
||||
}
|
||||
|
||||
public Float getTingjiDi() {
|
||||
return tingjiDi;
|
||||
}
|
||||
|
||||
public void setTingjiDi(Float tingjiDi) {
|
||||
this.tingjiDi = tingjiDi;
|
||||
}
|
||||
|
||||
public Float getTingjiGao() {
|
||||
return tingjiGao;
|
||||
}
|
||||
|
||||
public void setTingjiGao(Float tingjiGao) {
|
||||
this.tingjiGao = tingjiGao;
|
||||
}
|
||||
}
|
103
src/main/java/org/gyk/modules/sssj/entity/YasuojiBjSj.java
Normal file
103
src/main/java/org/gyk/modules/sssj/entity/YasuojiBjSj.java
Normal file
@ -0,0 +1,103 @@
|
||||
package org.gyk.modules.sssj.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class YasuojiBjSj implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String id; //工业库标志
|
||||
|
||||
private String bjId;//报警低值
|
||||
private LocalDateTime beginTime;//报警高值
|
||||
private LocalDateTime endTime;//报警高值
|
||||
private String bjMs;//停机低值
|
||||
private float canshuZhi;//停机高值
|
||||
private String stationname;
|
||||
private String jizuhao;
|
||||
private String zt;
|
||||
private boolean saveFlag;
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getBjId() {
|
||||
return bjId;
|
||||
}
|
||||
|
||||
public void setBjId(String bjId) {
|
||||
this.bjId = bjId;
|
||||
}
|
||||
|
||||
public LocalDateTime getBeginTime() {
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
public void setBeginTime(LocalDateTime beginTime) {
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(LocalDateTime endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getBjMs() {
|
||||
return bjMs;
|
||||
}
|
||||
|
||||
public void setBjMs(String bjMs) {
|
||||
this.bjMs = bjMs;
|
||||
}
|
||||
|
||||
public float getCanshuZhi() {
|
||||
return canshuZhi;
|
||||
}
|
||||
|
||||
public void setCanshuZhi(float canshuZhi) {
|
||||
this.canshuZhi = canshuZhi;
|
||||
}
|
||||
|
||||
public String getStationname() {
|
||||
return stationname;
|
||||
}
|
||||
|
||||
public void setStationname(String stationname) {
|
||||
this.stationname = stationname;
|
||||
}
|
||||
|
||||
public String getJizuhao() {
|
||||
return jizuhao;
|
||||
}
|
||||
|
||||
public void setJizuhao(String jizuhao) {
|
||||
this.jizuhao = jizuhao;
|
||||
}
|
||||
|
||||
public String getZt() {
|
||||
return zt;
|
||||
}
|
||||
|
||||
public void setZt(String zt) {
|
||||
this.zt = zt;
|
||||
}
|
||||
|
||||
public boolean isSaveFlag() {
|
||||
return saveFlag;
|
||||
}
|
||||
|
||||
public void setSaveFlag(boolean saveFlag) {
|
||||
this.saveFlag = saveFlag;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user