jiapeng 6 ans auparavant
Parent
commit
39cf6a803a

+ 3 - 2
src/main/java/com/ekexiu/project/bridge/servlet/WaveDataServlet.java

@ -118,6 +118,7 @@ public class WaveDataServlet extends HttpServlet {
118 118
						items.clear();
119 119
						break;
120 120
					}
121
					items.add(item);
121 122
				} else {
122 123
					items.clear();
123 124
					break;
@ -137,10 +138,10 @@ public class WaveDataServlet extends HttpServlet {
137 138
		response.setContentType("application/json");
138 139
		java.io.PrintWriter out = response.getWriter();
139 140
		if (items.isEmpty()) {
140
			out.write("{\"status\":0,}");
141
			out.write("{\"status\":0}");
141 142
			return;
142 143
		}
143
		out.write("{\"status\":1,}");
144
		out.write("{\"status\":1}");
144 145
		synchronized (DATA_CACHE) {
145 146
			DATA_CACHE.put(items.get(0).getSeq(), items);
146 147
		}

+ 264 - 0
src/main/resources/database.sql

@ -0,0 +1,264 @@
1
CREATE TABLE SYS_DICT (
2
        CODE TEXT NOT NULL,
3
        BCODE TEXT,
4
        DICT_CODE TEXT NOT NULL,
5
        CAPTION TEXT NOT NULL,
6
        FULL_CAPTION TEXT,
7
        SHORT_CUT TEXT,
8
        REMARK TEXT,
9
        READONLY CHAR(1) NOT NULL,
10
        ACTIVE CHAR(1) NOT NULL);
11
ALTER TABLE SYS_DICT ADD PRIMARY KEY (DICT_CODE,CODE);
12
COMMENT ON TABLE SYS_DICT IS '数据字典表';
13
COMMENT ON COLUMN SYS_DICT.CODE IS '字典项编码';
14
COMMENT ON COLUMN SYS_DICT.BCODE IS '字典项编码(业务编码)';
15
COMMENT ON COLUMN SYS_DICT.DICT_CODE IS '字典编码';
16
COMMENT ON COLUMN SYS_DICT.CAPTION IS '字典项显示';
17
COMMENT ON COLUMN SYS_DICT.FULL_CAPTION IS '字典项显示(全)';
18
COMMENT ON COLUMN SYS_DICT.SHORT_CUT IS '助记码';
19
COMMENT ON COLUMN SYS_DICT.REMARK IS '备注';
20
COMMENT ON COLUMN SYS_DICT.READONLY IS '是否只读';
21
COMMENT ON COLUMN SYS_DICT.ACTIVE IS '是否有效';
22

23
CREATE TABLE NOTICE (
24
        CNT TEXT,
25
        MODIFIER CHAR(32) NOT NULL,
26
        MODIFY_TIME CHAR(14) NOT NULL);
27
COMMENT ON TABLE NOTICE IS '系统公告';
28
COMMENT ON COLUMN NOTICE.CNT IS '备注';
29
COMMENT ON COLUMN NOTICE.MODIFIER IS '最后修改人ID';
30
COMMENT ON COLUMN NOTICE.MODIFY_TIME IS '最后修改时间(YYYYMMDDHH24MISS),初始值:20000101010101';
31

32
CREATE TABLE LUSER (
33
        ACTIVE CHAR(1) NOT NULL,
34
        PASSWD TEXT NOT NULL,
35
        ID CHAR(32) NOT NULL,
36
        NAME TEXT NOT NULL,
37
        ACCOUNT TEXT NOT NULL,
38
        COMP TEXT NOT NULL,
39
        JOB TEXT NOT NULL,
40
        PHONE TEXT,
41
        EMAIL TEXT,
42
        REMARK TEXT,
43
        TYPE INTEGER NOT NULL,
44
        CREATE_TIME CHAR(14) NOT NULL,
45
        MODIFY_TIME CHAR(14) NOT NULL,
46
        CREATOR CHAR(32) NOT NULL,
47
        MODIFIER CHAR(32) NOT NULL);
48
ALTER TABLE LUSER ADD PRIMARY KEY (ID);
49
ALTER TABLE LUSER ADD UNIQUE (ACCOUNT);
50
COMMENT ON TABLE LUSER IS '用户表';
51
COMMENT ON COLUMN LUSER.ACTIVE IS '是否可用';
52
COMMENT ON COLUMN LUSER.PASSWD IS '密码(MD5)';
53
COMMENT ON COLUMN LUSER.ID IS '用户ID';
54
COMMENT ON COLUMN LUSER.NAME IS '用户姓名';
55
COMMENT ON COLUMN LUSER.ACCOUNT IS '用户帐号';
56
COMMENT ON COLUMN LUSER.COMP IS '用户所属单位';
57
COMMENT ON COLUMN LUSER.JOB IS '用户职位';
58
COMMENT ON COLUMN LUSER.PHONE IS '联系电话';
59
COMMENT ON COLUMN LUSER.EMAIL IS '联系邮件';
60
COMMENT ON COLUMN LUSER.REMARK IS '备注';
61
COMMENT ON COLUMN LUSER.TYPE IS '账户类型';
62
COMMENT ON COLUMN LUSER.CREATE_TIME IS '创建时间(YYYYMMDDHH24MISS)不可修改';
63
COMMENT ON COLUMN LUSER.MODIFY_TIME IS '最后修改时间(YYYYMMDDHH24MISS),初始值:20000101010101';
64
COMMENT ON COLUMN LUSER.CREATOR IS '创建人ID';
65
COMMENT ON COLUMN LUSER.MODIFIER IS '最后修改人ID';
66

67

68
CREATE TABLE BRIDGE (
69
        ID CHAR(32) NOT NULL,
70
        ACTIVE CHAR(1) NOT NULL,
71
        CODE TEXT NOT NULL,
72
        SHORT_NAME TEXT NOT NULL,
73
        NAME TEXT NOT NULL,
74
        ADDR_CODE TEXT NOT NULL,
75
        SERVICE_DAY TEXT NOT NULL,
76
        LOCATION TEXT NOT NULL,
77
        DESCP TEXT,
78
        REMARK TEXT,
79
        IMG TEXT NOT NULL,
80
        ORG TEXT NOT NULL,
81
        PHONE TEXT NOT NULL,
82
        EMAIL TEXT NOT NULL,
83
        CREATE_TIME CHAR(14) NOT NULL,
84
        MODIFY_TIME CHAR(14) NOT NULL,
85
        CREATOR CHAR(32) NOT NULL,
86
        MODIFIER CHAR(32) NOT NULL);
87
ALTER TABLE BRIDGE ADD PRIMARY KEY (ID);
88
ALTER TABLE BRIDGE ADD UNIQUE (SHORT_NAME);
89
ALTER TABLE BRIDGE ADD UNIQUE (NAME);
90
COMMENT ON TABLE BRIDGE IS '桥梁信息';
91
COMMENT ON COLUMN BRIDGE.ID IS 'id';
92
COMMENT ON COLUMN BRIDGE.ACTIVE IS '是否可用';
93
COMMENT ON COLUMN BRIDGE.CODE IS '桥梁编号';
94
COMMENT ON COLUMN BRIDGE.SHORT_NAME IS '桥梁简称';
95
COMMENT ON COLUMN BRIDGE.NAME IS '桥梁名称(全称)';
96
COMMENT ON COLUMN BRIDGE.ADDR_CODE IS '桥梁政区划编码';
97
COMMENT ON COLUMN BRIDGE.SERVICE_DAY IS '桥梁开通日期(YYYYMMDD)';
98
COMMENT ON COLUMN BRIDGE.LOCATION IS '桥梁定位';
99
COMMENT ON COLUMN BRIDGE.DESCP IS '桥梁详细描述';
100
COMMENT ON COLUMN BRIDGE.REMARK IS '桥梁备注';
101
COMMENT ON COLUMN BRIDGE.ORG IS '桥梁维护机构名称';
102
COMMENT ON COLUMN BRIDGE.PHONE IS '桥梁维护机构电话';
103
COMMENT ON COLUMN BRIDGE.EMAIL IS '桥梁维护机构电邮';
104
COMMENT ON COLUMN BRIDGE.CREATE_TIME IS '创建时间(YYYYMMDDHH24MISS)不可修改';
105
COMMENT ON COLUMN BRIDGE.MODIFY_TIME IS '最后修改时间(YYYYMMDDHH24MISS),初始值:20000101010101';
106
COMMENT ON COLUMN BRIDGE.CREATOR IS '创建人ID';
107
COMMENT ON COLUMN BRIDGE.MODIFIER IS '最后修改人ID';
108

109

110
CREATE TABLE USER_BRIDGE (
111
        UID TEXT NOT NULL,
112
        BRIDGE TEXT NOT NULL);
113
COMMENT ON TABLE USER_BRIDGE IS '用户桥梁';
114
COMMENT ON COLUMN USER_BRIDGE.UID IS '用户ID';
115
COMMENT ON COLUMN USER_BRIDGE.BRIDGE IS '桥梁ID';
116

117
CREATE TABLE BRIDGE_SERVER (
118
        ID CHAR(32) NOT NULL,
119
        SEQ TEXT NOT NULL,
120
        ACTIVE CHAR(1) NOT NULL,
121
        CODE TEXT NOT NULL,
122
        BRIDGE_ID TEXT NOT NULL,
123
        IP TEXT NOT NULL,
124
        DEVICES INTEGER NOT NULL,
125
        REMARK TEXT,
126
        CREATE_TIME CHAR(14) NOT NULL,
127
        MODIFY_TIME CHAR(14) NOT NULL,
128
        CREATOR CHAR(32) NOT NULL,
129
        MODIFIER CHAR(32) NOT NULL);
130
ALTER TABLE BRIDGE_SERVER ADD PRIMARY KEY (ID);
131
COMMENT ON TABLE BRIDGE_SERVER IS '采集服务器';
132
COMMENT ON COLUMN BRIDGE_SERVER.ID IS 'id';
133
COMMENT ON COLUMN BRIDGE_SERVER.SEQ IS '内部编号';
134
COMMENT ON COLUMN BRIDGE_SERVER.ACTIVE IS '是否可用';
135
COMMENT ON COLUMN BRIDGE_SERVER.CODE IS '采集服务器编号';
136
COMMENT ON COLUMN BRIDGE_SERVER.BRIDGE_ID IS '采集服务器所属桥梁Id';
137
COMMENT ON COLUMN BRIDGE_SERVER.IP IS '采集服务器IP';
138
COMMENT ON COLUMN BRIDGE_SERVER.DEVICES IS '采集盒数量';
139
COMMENT ON COLUMN BRIDGE_SERVER.REMARK IS '备注';
140
COMMENT ON COLUMN BRIDGE_SERVER.CREATE_TIME IS '创建时间(YYYYMMDDHH24MISS)不可修改';
141
COMMENT ON COLUMN BRIDGE_SERVER.MODIFY_TIME IS '最后修改时间(YYYYMMDDHH24MISS),初始值:20000101010101';
142
COMMENT ON COLUMN BRIDGE_SERVER.CREATOR IS '创建人ID';
143
COMMENT ON COLUMN BRIDGE_SERVER.MODIFIER IS '最后修改人ID';
144

145
CREATE TABLE COLLECT_DEVICE (
146
        ID CHAR(32) NOT NULL,
147
        SEQ INTEGER NOT NULL,
148
        CODE TEXT NOT NULL,
149
        SERVER_ID TEXT NOT NULL,
150
        CHANNELS INTEGER NOT NULL,
151
        REMARK TEXT,
152
        ACTIVE CHAR(1) NOT NULL,
153
        CREATE_TIME CHAR(14) NOT NULL,
154
        MODIFY_TIME CHAR(14) NOT NULL,
155
        CREATOR CHAR(32) NOT NULL,
156
        MODIFIER CHAR(32) NOT NULL);
157
ALTER TABLE COLLECT_DEVICE ADD PRIMARY KEY (ID);
158
COMMENT ON TABLE COLLECT_DEVICE IS '采集盒';
159
COMMENT ON COLUMN COLLECT_DEVICE.ID IS 'id';
160
COMMENT ON COLUMN COLLECT_DEVICE.SEQ IS '内部编号';
161
COMMENT ON COLUMN COLLECT_DEVICE.CODE IS '采集盒编号';
162
COMMENT ON COLUMN COLLECT_DEVICE.SERVER_ID IS '采集盒所属服务器ID';
163
COMMENT ON COLUMN COLLECT_DEVICE.CHANNELS IS '采集盒信道数量';
164
COMMENT ON COLUMN COLLECT_DEVICE.REMARK IS '备注';
165
COMMENT ON COLUMN COLLECT_DEVICE.ACTIVE IS '是否可用';
166
COMMENT ON COLUMN COLLECT_DEVICE.CREATE_TIME IS '创建时间(YYYYMMDDHH24MISS)不可修改';
167
COMMENT ON COLUMN COLLECT_DEVICE.MODIFY_TIME IS '最后修改时间(YYYYMMDDHH24MISS),初始值:20000101010101';
168
COMMENT ON COLUMN COLLECT_DEVICE.CREATOR IS '创建人ID';
169
COMMENT ON COLUMN COLLECT_DEVICE.MODIFIER IS '最后修改人ID';
170

171

172
CREATE TABLE TRANSDUCER (
173
        ID CHAR(32) NOT NULL,
174
        SEQ INTEGER NOT NULL,
175
        CODE TEXT NOT NULL,
176
        DEVICE_ID TEXT NOT NULL,
177
        CABLE_TYPE TEXT NOT NULL,
178
        LOC_TYPE TEXT NOT NULL,
179
        REMARK TEXT,
180
        ACTIVE CHAR(1) NOT NULL,
181
        CREATE_TIME CHAR(14) NOT NULL,
182
        MODIFY_TIME CHAR(14) NOT NULL,
183
        CREATOR CHAR(32) NOT NULL,
184
        MODIFIER CHAR(32) NOT NULL);
185
ALTER TABLE TRANSDUCER ADD PRIMARY KEY (ID);
186
COMMENT ON TABLE TRANSDUCER IS '传感器';
187
COMMENT ON COLUMN TRANSDUCER.ID IS 'id';
188
COMMENT ON COLUMN TRANSDUCER.SEQ IS '内部编号';
189
COMMENT ON COLUMN TRANSDUCER.CODE IS '采集盒编号';
190
COMMENT ON COLUMN TRANSDUCER.DEVICE_ID IS '传感器编号';
191
COMMENT ON COLUMN TRANSDUCER.CABLE_TYPE IS '传感器所在主缆(dict)';
192
COMMENT ON COLUMN TRANSDUCER.LOC_TYPE IS '传感器所在位置(dict)';
193
COMMENT ON COLUMN TRANSDUCER.REMARK IS '备注';
194
COMMENT ON COLUMN TRANSDUCER.ACTIVE IS '是否可用';
195
COMMENT ON COLUMN TRANSDUCER.CREATE_TIME IS '创建时间(YYYYMMDDHH24MISS)不可修改';
196
COMMENT ON COLUMN TRANSDUCER.MODIFY_TIME IS '最后修改时间(YYYYMMDDHH24MISS),初始值:20000101010101';
197
COMMENT ON COLUMN TRANSDUCER.CREATOR IS '创建人ID';
198
COMMENT ON COLUMN TRANSDUCER.MODIFIER IS '最后修改人ID';
199

200
CREATE TABLE ALARM_DATA_ITEM (
201
        ID TEXT NOT NULL,
202
        SEQ INTEGER NOT NULL,
203
        STIME TEXT NOT NULL,
204
        ATIME TEXT NOT NULL,
205
        DATA TEXT NOT NULL);
206
ALTER TABLE ALARM_DATA_ITEM ADD PRIMARY KEY (ID,SEQ);
207
COMMENT ON TABLE ALARM_DATA_ITEM IS '报警数据';
208
COMMENT ON COLUMN ALARM_DATA_ITEM.ID IS '报警编号';
209
COMMENT ON COLUMN ALARM_DATA_ITEM.SEQ IS '传感内部编号';
210
COMMENT ON COLUMN ALARM_DATA_ITEM.STIME IS '起始时间';
211
COMMENT ON COLUMN ALARM_DATA_ITEM.ATIME IS '报警时间';
212
COMMENT ON COLUMN ALARM_DATA_ITEM.DATA IS '报警数据,共300个数据点,以英文逗号分隔';
213

214

215
CREATE TABLE ALARM_MSG (
216
        UID CHAR(32) NOT NULL,
217
        AID TEXT NOT NULL,
218
        SERVER TEXT NOT NULL,
219
        DEVICE INTEGER NOT NULL,
220
        READED CHAR(1) NOT NULL,
221
        READ_TIME TEXT,
222
        CREATE_TIME CHAR(14) NOT NULL,
223
        ALARM_TIME TEXT NOT NULL);
224
ALTER TABLE ALARM_MSG ADD PRIMARY KEY (UID,AID);
225
COMMENT ON TABLE ALARM_MSG IS '报警消息';
226
COMMENT ON COLUMN ALARM_MSG.UID IS '用户ID';
227
COMMENT ON COLUMN ALARM_MSG.AID IS '报警ID';
228
COMMENT ON COLUMN ALARM_MSG.SERVER IS '采集服务器内部编号';
229
COMMENT ON COLUMN ALARM_MSG.DEVICE IS '采集盒内部编号';
230
COMMENT ON COLUMN ALARM_MSG.READED IS '是否已读';
231
COMMENT ON COLUMN ALARM_MSG.READ_TIME IS '读取时间';
232
COMMENT ON COLUMN ALARM_MSG.CREATE_TIME IS '创建时间(YYYYMMDDHH24MISS)不可修改';
233
COMMENT ON COLUMN ALARM_MSG.ALARM_TIME IS '报警时间';
234

235

236
CREATE TABLE WAVE_DATA_ITEM (
237
        SEQ TEXT NOT NULL,
238
        CTIME TEXT NOT NULL,
239
        DID INTEGER NOT NULL,
240
        CID INTEGER NOT NULL,
241
        HVALUE INTEGER NOT NULL,
242
        LVALUE INTEGER NOT NULL);
243
ALTER TABLE WAVE_DATA_ITEM ADD PRIMARY KEY (CTIME,SEQ,DID,CID);
244
COMMENT ON TABLE WAVE_DATA_ITEM IS '监控历史数据';
245
COMMENT ON COLUMN WAVE_DATA_ITEM.SEQ IS '采集服务器内部编号';
246
COMMENT ON COLUMN WAVE_DATA_ITEM.CTIME IS '上传时间(YYYYMMDDHH24MISS';
247
COMMENT ON COLUMN WAVE_DATA_ITEM.DID IS '采集盒内部编号';
248
COMMENT ON COLUMN WAVE_DATA_ITEM.CID IS '传感器内部编号';
249
COMMENT ON COLUMN WAVE_DATA_ITEM.HVALUE IS '一秒内最大幅度值';
250
COMMENT ON COLUMN WAVE_DATA_ITEM.LVALUE IS '一秒内最小幅度值';
251

252

253

254
INSERT INTO LUSER (active, passwd, id, name,account, comp,job,phone,email,remark,type, create_time,modify_time, creator, modifier) 
255
VALUES 
256
('1', 'E10ADC3949BA59ABBE56E057F20F883E', '77005D20EAB44360918AFD2EA5B867AE', 'admin', '18888888888', 'kexiu', 'a', '18888888888', 
257
'admin@ekexiu.com', NULL, '1', '20180801123001', '20000101010101', '77005D20EAB44360918AFD2EA5B867AE', '77005D20EAB44360918AFD2EA5B867AE');
258

259
INSERT INTO sys_dict (code, bcode, dict_code, caption, full_caption, short_cut, remark, readonly, active) VALUES ('01', NULL, 'ZLLX', '上游主缆', NULL, NULL, NULL, '0', '1');
260
INSERT INTO sys_dict (code, bcode, dict_code, caption, full_caption, short_cut, remark, readonly, active) VALUES ('02', NULL, 'ZLLX', '下游主缆', NULL, NULL, NULL, '0', '1');
261
INSERT INTO sys_dict (code, bcode, dict_code, caption, full_caption, short_cut, remark, readonly, active) VALUES ('01', NULL, 'ZLWZ', '东跨', NULL, NULL, NULL, '0', '1');
262
INSERT INTO sys_dict (code, bcode, dict_code, caption, full_caption, short_cut, remark, readonly, active) VALUES ('02', NULL, 'ZLWZ', '西跨', NULL, NULL, NULL, '0', '1');
263

264


+ 3 - 3
src/main/resources/project.properties

@ -1,8 +1,8 @@
1 1
dataSource=com.alibaba.druid.pool.DruidDataSource
2 2
#数据库连接地址、名称、密码
3
dataSource.url=jdbc:postgresql://localhost:5432/bridge
3
dataSource.url=jdbc:postgresql://47.100.53.9:5432/bridge
4 4
dataSource.username=postgres
5
dataSource.password=postgres
5
dataSource.password=postgres_bridge
6 6
#连接池启动时的初始值(初始化连接)
7 7
dataSource.initialSize::int=1
8 8
#最小空闲连接值
@ -30,4 +30,4 @@ dataSource.maxPoolPreparedStatementPerConnectionSize::int=20
30 30
#默认的SQL语句自动提交状态(开启或关闭)设置由连接池本身设置(false由连接池定)
31 31
dataSource.defaultAutoCommit::boolean=false
32 32
33
com_ekexiu_portal_ware_WareService.imgPath::java.io.File=D:/tmp/data/bridge
33
com_ekexiu_project_bridge_resource_service_BridgeService.imgPath::java.io.File=/bridge/web_data/data/bridge