jiapeng 6 ans auparavant
Parent
commit
e752934da4

+ 3 - 0
src/main/java/com/ekexiu/project/bridge/alarm/AlarmDao.java

@ -17,6 +17,9 @@ import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
17 17
import org.jfw.util.PageQueryResult;
18 18
@DAO
19 19
public interface AlarmDao {
20
	@Insert
21
	int insert(Connection con,AlarmDataError cnt)throws SQLException;
22
	
20 23
	@Insert
21 24
	int insert(Connection con,AlarmMsg msg)throws SQLException;
22 25
	@Insert

+ 36 - 0
src/main/java/com/ekexiu/project/bridge/alarm/AlarmDataError.java

@ -0,0 +1,36 @@
1
package com.ekexiu.project.bridge.alarm;
2

3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.Table;
5
import org.jfw.apt.orm.core.enums.DE;
6
@Table(descp="报警数据错误表")
7
public class AlarmDataError {
8

9
	private String cnt;
10
	private long  rtime;
11
	private String reason;
12
	
13
	@Column(descp="接口数据",value=DE.text_de)
14
	public String getCnt() {
15
		return cnt;
16
	}
17
	public void setCnt(String cnt) {
18
		this.cnt = cnt;
19
	}
20
	@Column(descp="接口数据接收时间",value=DE.long_de)
21
	public long getRtime() {
22
		return rtime;
23
	}
24
	public void setRtime(long rtime) {
25
		this.rtime = rtime;
26
	}
27
	@Column(descp="接口数据错误原因",value=DE.text_de)
28
	public String getReason() {
29
		return reason;
30
	}
31
	public void setReason(String reason) {
32
		this.reason = reason;
33
	}
34
	
35
	
36
}

+ 5 - 4
src/main/java/com/ekexiu/project/bridge/alarm/AlarmService.java

@ -51,14 +51,15 @@ public class AlarmService {
51 51
		}
52 52
		sb.append(") AND UID=? AND READED='0' GROUP BY SERVER");
53 53
		
54
		return JdbcUtil.queryList(con, sb.toString(), new ResultSetExtractor<Map<String,Integer>>() {
54
		return JdbcUtil.queryList(con, sb.toString(), new ResultSetExtractor<Map<String,Object>>() {
55 55

56 56
			@Override
57
			public Map<String, Integer> extractData(ResultSet rs) throws SQLException {
58
				Map<String,Integer> map = new HashMap<String,Integer>();
57
			public Map<String, Object> extractData(ResultSet rs) throws SQLException {
58
				Map<String,Object> map = new HashMap<String,Object>();
59 59
				String s= rs.getString(1);
60 60
				int c = rs.getInt(2);
61
				map.put(s, c);
61
				map.put("server",s);
62
				map.put("num",c);
62 63
				return map;
63 64
			}
64 65
		}, new PreparedStatementConfig() {

+ 3 - 0
src/main/java/com/ekexiu/project/bridge/collect/CollectDao.java

@ -17,6 +17,9 @@ import org.jfw.apt.orm.annotation.dao.param.LtEq;
17 17
@DAO
18 18
public interface CollectDao {
19 19

20
	@Insert
21
	int insertWaveDataError(Connection con,WaveDataError cnt)throws SQLException;
22
	
20 23
	@Insert
21 24
	@Batch
22 25
	int[] insertWaveDataItems(Connection con,List<WaveDataItem> items)throws SQLException;

+ 37 - 0
src/main/java/com/ekexiu/project/bridge/collect/WaveDataError.java

@ -0,0 +1,37 @@
1
package com.ekexiu.project.bridge.collect;
2

3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.Table;
5
import org.jfw.apt.orm.core.enums.DE;
6

7
@Table(descp="实时数据错误表")
8
public class WaveDataError {
9

10
	private String cnt;
11
	private long  rtime;
12
	private String reason;
13
	
14
	@Column(descp="接口数据",value=DE.text_de)
15
	public String getCnt() {
16
		return cnt;
17
	}
18
	public void setCnt(String cnt) {
19
		this.cnt = cnt;
20
	}
21
	@Column(descp="接口数据接收时间",value=DE.long_de)
22
	public long getRtime() {
23
		return rtime;
24
	}
25
	public void setRtime(long rtime) {
26
		this.rtime = rtime;
27
	}
28
	@Column(descp="接口数据错误原因",value=DE.text_de)
29
	public String getReason() {
30
		return reason;
31
	}
32
	public void setReason(String reason) {
33
		this.reason = reason;
34
	}
35
	
36
	
37
}

+ 174 - 119
src/main/java/com/ekexiu/project/bridge/servlet/AlarmDataServlet.java

@ -5,6 +5,7 @@ import java.io.IOException;
5 5
import java.io.InputStream;
6 6
import java.lang.reflect.Type;
7 7
import java.sql.Connection;
8
import java.sql.SQLException;
8 9
import java.util.HashMap;
9 10
import java.util.LinkedList;
10 11
import java.util.List;
@ -16,6 +17,7 @@ import javax.servlet.http.HttpServletRequest;
16 17
import javax.servlet.http.HttpServletResponse;
17 18
import javax.sql.DataSource;
18 19

20
import org.jfw.apt.util.Base64;
19 21
import org.jfw.util.ConstData;
20 22
import org.jfw.util.context.JfwAppContext;
21 23
import org.jfw.util.io.IoUtil;
@ -24,6 +26,7 @@ import org.jfw.util.json.JsonService;
24 26
import org.jfw.util.reflect.TypeReference;
25 27

26 28
import com.ekexiu.project.bridge.alarm.AlarmDao;
29
import com.ekexiu.project.bridge.alarm.AlarmDataError;
27 30
import com.ekexiu.project.bridge.alarm.AlarmDataItem;
28 31
import com.ekexiu.project.bridge.alarm.AlarmMsg;
29 32
import com.ekexiu.project.bridge.mail.MailService;
@ -64,157 +67,190 @@ public class AlarmDataServlet extends HttpServlet {
64 67
		final AlarmMsg msg = new AlarmMsg();
65 68
		StringBuilder sb = new StringBuilder();
66 69
		final Map<User, String> notices = new HashMap<User, String>();
67
		List<Object> datas = null;
70
		Map<Object, Object> map = null;
68 71
		AlarmDataItem item = null;
72
		final Map<String, String> errorData = new HashMap<String, String>();
73
		String pcnt = null;
74

75
		List<Object> datas = null;
69 76
		try {
70 77
			byte[] buf = new byte[8192];
71 78
			IoUtil.copy(in, baos, buf);
72
			Map<Object, Object> map = JsonService.fromJson(new String(baos.toByteArray(), ConstData.UTF8), DATA_TYPE);
73
			Object tmpObj = map.get("node_id");
74
			if (tmpObj != null && tmpObj instanceof String) {
75
				msg.setServer((String) tmpObj);
76
				tmpObj = map.get("alarm_no");
77
				if (tmpObj != null && tmpObj instanceof String) {
78
					msg.setAid((String) tmpObj);
79
					tmpObj = map.get("box_id");
80
					if (tmpObj != null && tmpObj instanceof String) {
81
						try {
82
							msg.setDevice(Integer.parseInt((String) tmpObj));
83
							tmpObj = map.get("data");
84
							if (tmpObj != null && tmpObj instanceof List) {
85
								datas = (List<Object>) tmpObj;
86
							}
87
						} catch (Exception e) {
88
						}
89
					}
79
			byte[] ba = baos.toByteArray();
80

81
			if (ba.length == 0) {
82
				errorData.put(" ", "EMPTY");
83
			} else {
84
				try {
85
					pcnt = new String(baos.toByteArray(), ConstData.UTF8);
86
				} catch (Exception e) {
87
					errorData.put(new String(Base64.encodeBase64(ba), ConstData.UTF8), "CHARSET");
90 88
				}
91
			}
92
			if (datas != null) {
93
				for (Object obj : datas) {
94
					item = new AlarmDataItem();
95
					if (obj != null && obj instanceof Map) {
96
						map = (Map<Object, Object>) obj;
97
						item.setId(msg.getAid());
98
						tmpObj = map.get("channel_id");
89
				if (pcnt != null) {
90
					try {
91
						map = JsonService.fromJson(pcnt, DATA_TYPE);
92
					} catch (Exception e) {
93
						errorData.put(pcnt, "JSON_PARSE");
94
					}
95
					if (map != null) {
96
						Object tmpObj = map.get("node_id");
99 97
						if (tmpObj != null && tmpObj instanceof String) {
100
							try {
101
								item.setSeq(Integer.parseInt((String) tmpObj));
102
							} catch (Exception e) {
103
								items.clear();
104
								break;
98
							msg.setServer((String) tmpObj);
99
							tmpObj = map.get("alarm_no");
100
							if (tmpObj != null && tmpObj instanceof String) {
101
								msg.setAid((String) tmpObj);
102
								tmpObj = map.get("box_id");
103
								if (tmpObj != null && tmpObj instanceof String) {
104
									try {
105
										msg.setDevice(Integer.parseInt((String) tmpObj));
106
										tmpObj = map.get("data");
107
										if (tmpObj != null && tmpObj instanceof List) {
108
											datas = (List<Object>) tmpObj;
109
										}
110
									} catch (Exception e) {
111
									}
112
								}
105 113
							}
106
						} else {
107
							items.clear();
108
							break;
109
						}
110
						tmpObj = map.get("start_time");
111
						if (tmpObj != null && tmpObj instanceof String) {
112
							item.setStime((String) tmpObj);
113
						} else {
114
							items.clear();
115
							break;
116 114
						}
117
						tmpObj = map.get("alarm_time");
118
						if (tmpObj != null && tmpObj instanceof String) {
119
							item.setStime((String) tmpObj);
120
							if (msg.getAlarmTime() == null) {
121
								String at = (String) tmpObj;
122
								at = at.substring(0, 14);
123
								msg.setAlarmTime(at);
124
							}
115
						if (datas != null) {
116
							for (Object obj : datas) {
117
								item = new AlarmDataItem();
118
								if (obj != null && obj instanceof Map) {
119
									map = (Map<Object, Object>) obj;
120
									item.setId(msg.getAid());
121
									tmpObj = map.get("channel_id");
122
									if (tmpObj != null && tmpObj instanceof String) {
123
										try {
124
											item.setSeq(Integer.parseInt((String) tmpObj));
125
										} catch (Exception e) {
126
											items.clear();
127
											break;
128
										}
129
									} else {
130
										items.clear();
131
										break;
132
									}
133
									tmpObj = map.get("start_time");
134
									if (tmpObj != null && tmpObj instanceof String) {
135
										item.setStime((String) tmpObj);
136
									} else {
137
										items.clear();
138
										break;
139
									}
140
									tmpObj = map.get("alarm_time");
141
									if (tmpObj != null && tmpObj instanceof String) {
142
										item.setStime((String) tmpObj);
143
										if (msg.getAlarmTime() == null) {
144
											String at = (String) tmpObj;
145
											at = at.substring(0, 14);
146
											msg.setAlarmTime(at);
147
										}
125 148

126
						} else {
127
							items.clear();
128
							break;
129
						}
149
									} else {
150
										items.clear();
151
										break;
152
									}
130 153

131
						sb.setLength(0);
132
						tmpObj = map.get("value");
133
						if (tmpObj != null && tmpObj instanceof List) {
134
							for (Object val : ((List) tmpObj)) {
135
								sb.append(val.toString()).append(",");
154
									sb.setLength(0);
155
									tmpObj = map.get("value");
156
									if (tmpObj != null && tmpObj instanceof List) {
157
										for (Object val : ((List) tmpObj)) {
158
											sb.append(val.toString()).append(",");
159
										}
160
									}
161
									if (sb.length() > 0) {
162
										item.setData(sb.substring(0, sb.length() - 1));
163
									} else {
164
										items.clear();
165
										break;
166
									}
167
									items.add(item);
168
								}
136 169
							}
137 170
						}
138
						if (sb.length() > 0) {
139
							item.setData(sb.substring(0, sb.length() - 1));
140
						} else {
141
							items.clear();
142
							break;
143
						}
144
						items.add(item);
145 171
					}
146 172
				}
147 173
			}
148 174
		} finally {
149 175
			in.close();
150 176
		}
151
		Connection con = null;
152
		try {
153
			con = this.dataSource.getConnection();
154
			BridgeServer server = this.bridgeServerDao.queryBySeq(con, msg.getServer());
155
			if (server != null) {
156
				Bridge bridge = this.bridgeDao.query(con, server.getBridgeId());
157
				if (bridge != null) {
158
					CollectDevice device = this.collectDeviceDao.query(con, server.getId(), msg.getDevice());
159
					if (device != null) {
160
						String atime = items.get(0).getAtime();
161
						String cnt = "您负责管理维护的桥梁:【" + bridge.getShortName() + "】,于【" + atime.substring(0, 4) + "-" + atime.substring(4, 6) + "-"
162
								+ atime.substring(6, 8) + " " + atime.substring(8, 10) + ":" + atime.substring(10, 12) + ":" + atime.substring(12, 14)
163
								+ "】,编号为【" + device.getCode() + "】的采集盒发生一起报警事件,请尽快登录平台查看详细的报警信息。";
164
						List<User> users = this.userDao.queryByBridgeId(con, bridge.getId(), true);
165
						if (users != null && users.size() > 0) {
166
							for (User u : users) {
167
								msg.setUid(u.getId());
168
								this.alarmDao.insert(con, msg);
169
								notices.put(u, cnt);
177
		if (items.size() > 0) {
178

179
			Connection con = null;
180
			try {
181
				con = this.dataSource.getConnection();
182
				BridgeServer server = this.bridgeServerDao.queryBySeq(con, msg.getServer());
183
				if (server != null) {
184
					Bridge bridge = this.bridgeDao.query(con, server.getBridgeId());
185
					if (bridge != null) {
186
						CollectDevice device = this.collectDeviceDao.query(con, server.getId(), msg.getDevice());
187
						if (device != null) {
188
							String atime = items.get(0).getAtime();
189
							String cnt = "您负责管理维护的桥梁:【" + bridge.getShortName() + "】,于【" + atime.substring(0, 4) + "-" + atime.substring(4, 6) + "-"
190
									+ atime.substring(6, 8) + " " + atime.substring(8, 10) + ":" + atime.substring(10, 12) + ":" + atime.substring(12, 14)
191
									+ "】,编号为【" + device.getCode() + "】的采集盒发生一起报警事件,请尽快登录平台查看详细的报警信息。";
192
							List<User> users = this.userDao.queryByBridgeId(con, bridge.getId(), true);
193
							if (users != null && users.size() > 0) {
194
								for (User u : users) {
195
									msg.setUid(u.getId());
196
									this.alarmDao.insert(con, msg);
197
									notices.put(u, cnt);
198
								}
199
								this.alarmDao.insertAlarmDataItems(con, items);
200
							} else {
201
								errorData.put(pcnt, "NOT FOUND USER");
202
								items.clear();
170 203
							}
171
							this.alarmDao.insertAlarmDataItems(con, items);
172 204
						} else {
205
							errorData.put(pcnt, "NOT FOUND DEVICE");
173 206
							items.clear();
174 207
						}
175 208
					} else {
209
						errorData.put(pcnt, "NOT FOUND BRIDGE");
176 210
						items.clear();
177 211
					}
178 212
				} else {
213
					errorData.put(pcnt, "NOT FOUND SERVER");
179 214
					items.clear();
180 215
				}
181
			} else {
182
				items.clear();
183
			}
184
			if (items.size() > 0) {
185
				con.commit();
186
				JfwAppContext.getScheduledExecutorService().equals(new Runnable() {
187
					@Override
188
					public void run() {
216
				if (items.size() > 0) {
217
					con.commit();
218
					JfwAppContext.getScheduledExecutorService().equals(new Runnable() {
219
						@Override
220
						public void run() {
189 221

190
						for (Map.Entry<User, String> entry : notices.entrySet()) {
191
							User u = entry.getKey();
192
							String to = u.getEmail();
193
							try {
194
								if (to != null && to.length() > 0) {
195
									mailService.sendSimpleMail(to, "【" + u.getName() + "】您好:<br>" + entry.getValue(), null, "桥梁临控报警");
222
							for (Map.Entry<User, String> entry : notices.entrySet()) {
223
								User u = entry.getKey();
224
								String to = u.getEmail();
225
								try {
226
									if (to != null && to.length() > 0) {
227
										mailService.sendSimpleMail(to, "【" + u.getName() + "】您好:<br>" + entry.getValue(), null, "桥梁临控报警");
228
									}
229
								} catch (Throwable thr) {
196 230
								}
197
							} catch (Throwable thr) {
198
							}
199
							to = u.getPhone();
200
							try {
201
								if (to != null && to.length() > 0) {
202
									phoneService.sendMessage(to, "【__USERNAME__】您好:" + entry.getValue(), "__USERNAME__", u.getName());
231
								to = u.getPhone();
232
								try {
233
									if (to != null && to.length() > 0) {
234
										phoneService.sendMessage(to, "【__USERNAME__】您好:" + entry.getValue(), "__USERNAME__", u.getName());
235
									}
236
								} catch (Throwable thr) {
203 237
								}
204
							} catch (Throwable thr) {
205 238
							}
206
						}
207 239

208
					}
209
				});
240
						}
241
					});
242
				}
243
			} catch (Exception e) {
244
				if (null != con)
245
					JdbcUtil.rollback(con);
246
				items.clear();
247
			} finally {
248
				if (null != con)
249
					JdbcUtil.close(con);
210 250
			}
211
		} catch (Exception e) {
212
			if (null != con)
213
				JdbcUtil.rollback(con);
214
			items.clear();
215
		} finally {
216
			if (null != con)
217
				JdbcUtil.close(con);
251
		} else {
252
			if (errorData.isEmpty())
253
				errorData.put(pcnt, "ALARMDATA_PARSE");
218 254
		}
219 255

220 256
		response.setDateHeader("Expires", 0);
@ -228,10 +264,29 @@ public class AlarmDataServlet extends HttpServlet {
228 264
		response.setContentType("application/json");
229 265
		java.io.PrintWriter out = response.getWriter();
230 266
		if (items.isEmpty()) {
231
			out.write("{\"status\":0,}");
267
			out.write("{\"status\":0}");
268

269
			try {
270
				Connection con = dataSource.getConnection();
271
				try {
272
					for (Map.Entry<String, String> entry : errorData.entrySet()) {
273
						AlarmDataError wde = new AlarmDataError();
274
						wde.setCnt(entry.getKey());
275
						wde.setReason(entry.getValue());
276
						wde.setRtime(System.currentTimeMillis());
277
						alarmDao.insert(con, wde);
278
					}
279
					con.commit();
280
				} catch (SQLException e) {
281
					con.rollback();
282
				} finally {
283
					con.close();
284
				}
285
			} catch (Throwable thr) {
286
			}
232 287
			return;
233 288
		}
234
		out.write("{\"status\":1,}");
289
		out.write("{\"status\":1}");
235 290
	}
236 291

237 292
	@Override

+ 120 - 68
src/main/java/com/ekexiu/project/bridge/servlet/WaveDataServlet.java

@ -17,6 +17,7 @@ import javax.servlet.http.HttpServletRequest;
17 17
import javax.servlet.http.HttpServletResponse;
18 18
import javax.sql.DataSource;
19 19

20
import org.jfw.apt.util.Base64;
20 21
import org.jfw.util.ConstData;
21 22
import org.jfw.util.context.JfwAppContext;
22 23
import org.jfw.util.io.IoUtil;
@ -25,6 +26,7 @@ import org.jfw.util.reflect.TypeReference;
25 26

26 27
import com.ekexiu.project.bridge.collect.CollectDao;
27 28
import com.ekexiu.project.bridge.collect.CollectService;
29
import com.ekexiu.project.bridge.collect.WaveDataError;
28 30
import com.ekexiu.project.bridge.collect.WaveDataItem;
29 31

30 32
public class WaveDataServlet extends HttpServlet {
@ -35,7 +37,8 @@ public class WaveDataServlet extends HttpServlet {
35 37
	@SuppressWarnings("unused")
36 38
	private static final LinkedList<List<WaveDataItem>> EMPTY_LIST = new LinkedList<List<WaveDataItem>>();
37 39

38
	public static Type DATA_TYPE=new TypeReference<List<Object>>(){}.getType();
40
	public static Type DATA_TYPE = new TypeReference<List<Object>>() {
41
	}.getType();
39 42

40 43
	private DataSource dataSource;
41 44
	private CollectDao collectDao;
@ -49,79 +52,104 @@ public class WaveDataServlet extends HttpServlet {
49 52
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
50 53
		InputStream in = request.getInputStream();
51 54
		final List<WaveDataItem> items = new LinkedList<WaveDataItem>();
55
		final Map<String, String> errorData = new HashMap<String, String>();
56
		String cnt = null;
57
		List<Object> param = null;
52 58
		try {
53 59
			byte[] buf = new byte[8192];
54 60
			IoUtil.copy(in, baos, buf);
55
			List<Object> param = JsonService.fromJson(new String(baos.toByteArray(), ConstData.UTF8), DATA_TYPE);
56
			for (Object obj : param) {
57
				if (obj instanceof List) {
58
					WaveDataItem item = new WaveDataItem();
59
					Object tmpObj = ((List) obj).get(0);
60
					if (tmpObj instanceof String) {
61
						item.setSeq((String) tmpObj);
62
					} else {
63
						items.clear();
64
						break;
65
					}
66
					tmpObj = ((List) obj).get(3);
67
					if (tmpObj instanceof String) {
68
						item.setCtime((String) tmpObj);
69
					} else {
70
						items.clear();
71
						break;
72
					}
73
					tmpObj = ((List) obj).get(1);
74
					if (tmpObj instanceof String) {
75
						try {
76
							item.setDid(Integer.parseInt((String) tmpObj));
77
						} catch (Exception e) {
78
							items.clear();
79
							break;
80
						}
81
					} else {
82
						items.clear();
83
						break;
84
					}
85
					tmpObj = ((List) obj).get(2);
86
					if (tmpObj instanceof String) {
87
						try {
88
							item.setCid(Integer.parseInt((String) tmpObj));
89
						} catch (Exception e) {
90
							items.clear();
91
							break;
92
						}
93
					} else {
94
						items.clear();
95
						break;
61
			byte[] ba = baos.toByteArray();
62
			if (ba.length == 0) {
63
				errorData.put(" ", "EMPTY");
64
			} else {
65
				try {
66
					cnt = new String(baos.toByteArray(), ConstData.UTF8);
67
				} catch (Exception e) {
68
					errorData.put(new String(Base64.encodeBase64(ba), ConstData.UTF8), "CHARSET");
69
				}
70
				if (cnt != null) {
71
					try {
72
						param = JsonService.fromJson(cnt, DATA_TYPE);
73
					} catch (Exception e) {
74
						errorData.put(cnt, "JSON_PARSE");
96 75
					}
97
					tmpObj = ((List) obj).get(4);
98
					if (tmpObj instanceof String) {
99
						try {
100
							item.setLvalue(Integer.parseInt((String) tmpObj));
101
						} catch (Exception e) {
102
							items.clear();
103
							break;
76
					if (param != null) {
77
						for (Object obj : param) {
78
							if (obj instanceof List && ((List)obj).size()>5) {
79
								WaveDataItem item = new WaveDataItem();
80
								Object tmpObj = ((List) obj).get(0);
81
								if (tmpObj instanceof String) {
82
									item.setSeq((String) tmpObj);
83
								} else {
84
									items.clear();
85
									break;
86
								}
87
								tmpObj = ((List) obj).get(3);
88
								if (tmpObj instanceof String) {
89
									item.setCtime((String) tmpObj);
90
								} else {
91
									items.clear();
92
									break;
93
								}
94
								tmpObj = ((List) obj).get(1);
95
								if (tmpObj instanceof String) {
96
									try {
97
										item.setDid(Integer.parseInt((String) tmpObj));
98
									} catch (Exception e) {
99
										items.clear();
100
										break;
101
									}
102
								} else {
103
									items.clear();
104
									break;
105
								}
106
								tmpObj = ((List) obj).get(2);
107
								if (tmpObj instanceof String) {
108
									try {
109
										item.setCid(Integer.parseInt((String) tmpObj));
110
									} catch (Exception e) {
111
										items.clear();
112
										break;
113
									}
114
								} else {
115
									items.clear();
116
									break;
117
								}
118
								tmpObj = ((List) obj).get(4);
119
								if (tmpObj instanceof String) {
120
									try {
121
										item.setLvalue(Integer.parseInt((String) tmpObj));
122
									} catch (Exception e) {
123
										items.clear();
124
										break;
125
									}
126
								} else {
127
									items.clear();
128
									break;
129
								}
130
								tmpObj = ((List) obj).get(5);
131
								if (tmpObj instanceof String) {
132
									try {
133
										item.setHvalue(Integer.parseInt((String) tmpObj));
134
									} catch (Exception e) {
135
										items.clear();
136
										break;
137
									}
138
								} else {
139
									items.clear();
140
									break;
141
								}
142
								items.add(item);
143
							} else {
144
								items.clear();
145
								break;
146
							}
104 147
						}
105
					} else {
106
						items.clear();
107
						break;
108
					}
109
					tmpObj = ((List) obj).get(5);
110
					if (tmpObj instanceof String) {
111
						try {
112
							item.setHvalue(Integer.parseInt((String) tmpObj));
113
						} catch (Exception e) {
114
							items.clear();
115
							break;
148
					
149
						if(items.isEmpty()){
150
							errorData.put(cnt,"WAVEDATA_PARSE");
116 151
						}
117
					} else {
118
						items.clear();
119
						break;
120 152
					}
121
					items.add(item);
122
				} else {
123
					items.clear();
124
					break;
125 153
				}
126 154
			}
127 155
		} finally {
@ -139,6 +167,31 @@ public class WaveDataServlet extends HttpServlet {
139 167
		java.io.PrintWriter out = response.getWriter();
140 168
		if (items.isEmpty()) {
141 169
			out.write("{\"status\":0}");
170
			JfwAppContext.getScheduledExecutorService().execute(new Runnable() {
171
				@Override
172
				public void run() {
173
					try {
174
						Connection con = dataSource.getConnection();
175
						try {
176
							for(Map.Entry<String,String> entry:errorData.entrySet()){
177
								WaveDataError wde = new WaveDataError();
178
								wde.setCnt(entry.getKey());
179
								wde.setReason(entry.getValue());
180
								wde.setRtime(System.currentTimeMillis());
181
								collectDao.insertWaveDataError(con, wde);
182
							}
183
							con.commit();
184
						} catch (SQLException e) {
185
							con.rollback();
186
						} finally {
187
							con.close();
188
						}
189
					} catch (Throwable thr) {
190
					}
191

192
				}
193
			});
194
			
142 195
			return;
143 196
		}
144 197
		out.write("{\"status\":1}");
@ -165,7 +218,6 @@ public class WaveDataServlet extends HttpServlet {
165 218
		});
166 219
	}
167 220

168

169 221
	@Override
170 222
	public void init() throws ServletException {
171 223
		this.dataSource = JfwAppContext.getDataSource();

+ 1 - 1
src/main/java/com/ekexiu/project/bridge/system/service/DictService.java

@ -122,7 +122,7 @@ public class DictService {
122 122
	@Post
123 123
	@Path("/modify")
124 124
	public int update(@JdbcConn(true) Connection con, String code, String dict, @Nullable String bcode, String caption, @Nullable String fullCaption,
125
			@Nullable String shortCut, @Nullable String remark, boolean readonly, @AfterCommit List<Runnable> runs) throws SQLException {
125
			@Nullable String shortCut, @Nullable String remark, @AfterCommit List<Runnable> runs) throws SQLException {
126 126
		int num = this.dictDao.update(con, bcode, caption, fullCaption, shortCut, remark, code, dict);
127 127
		if (num > 0) {
128 128
			final DictItem item = new DictItem();