|
@ -52,6 +52,16 @@ public class EnvDataService {
|
52
|
52
|
this.lastData.set(lastData);
|
53
|
53
|
}
|
54
|
54
|
|
|
55
|
public EnvData query(int seq) {
|
|
56
|
List<EnvData> dataList = lastData.get();
|
|
57
|
for (EnvData envData : dataList) {
|
|
58
|
if (envData.getItemId() == seq) {
|
|
59
|
return envData;
|
|
60
|
}
|
|
61
|
}
|
|
62
|
return null;
|
|
63
|
}
|
|
64
|
|
55
|
65
|
@Path("/openlog")
|
56
|
66
|
@Get
|
57
|
67
|
public void openlog() {
|
|
@ -205,12 +215,17 @@ public class EnvDataService {
|
205
|
215
|
List<EnvTranLastValue> transducers = envDataDao.queryByServer(con, active, serverIds);
|
206
|
216
|
for (EnvTranLastValue transducer : transducers) {
|
207
|
217
|
final int id = transducer.getSeq();
|
208
|
|
transducer.setLastValue(JdbcUtil.queryDouble(con, "select item_value from env_data WHERE item_id = ? ORDER BY create_time desc limit 1", new PreparedStatementConfig() {
|
209
|
|
@Override
|
210
|
|
public void config(PreparedStatement preparedStatement) throws SQLException {
|
211
|
|
preparedStatement.setInt(1,id);
|
212
|
|
}
|
213
|
|
},0));
|
|
218
|
EnvData envData = query(id);
|
|
219
|
if (envData != null) {
|
|
220
|
transducer.setLastValue(envData.getItemValue());
|
|
221
|
}else {
|
|
222
|
transducer.setLastValue(JdbcUtil.queryDouble(con, "select item_value from env_data WHERE item_id = ? ORDER BY create_time desc limit 1", new PreparedStatementConfig() {
|
|
223
|
@Override
|
|
224
|
public void config(PreparedStatement preparedStatement) throws SQLException {
|
|
225
|
preparedStatement.setInt(1, id);
|
|
226
|
}
|
|
227
|
}, 0));
|
|
228
|
}
|
214
|
229
|
}
|
215
|
230
|
result.put("transducer", transducers);
|
216
|
231
|
} else {
|