|
|
@@ -95,7 +95,7 @@ public class GrainPushsServiceImpl implements GrainPushsService {
|
|
95
|
95
|
}
|
|
96
|
96
|
String orgId = temperatureRecordService.getOrgId(cDcsCodes.get(0));
|
|
97
|
97
|
ts.forEach(obj -> {
|
|
98
|
|
- String testdataId = uuidUtils.getCodeId(orgId, "t_testdata");
|
|
|
98
|
+ String testdataId = UuidUtils.getCode();
|
|
99
|
99
|
TTestdata tTestdata = (TTestdata) obj;
|
|
100
|
100
|
String house = tTestdata.getStorehouse();
|
|
101
|
101
|
Date time = tTestdata.getTime();
|
|
|
@@ -105,12 +105,14 @@ public class GrainPushsServiceImpl implements GrainPushsService {
|
|
105
|
105
|
//获取报警阈值信息6972测温 6983温度高限 6982温度底限 6991温度预警
|
|
106
|
106
|
TWarningThreshold threshold = null; //温度高限
|
|
107
|
107
|
TWarningThreshold wLowest = null; //温度底限
|
|
108
|
|
- TWarningThreshold wWarning = null; //温度预警
|
|
|
108
|
+ TWarningThreshold thresholdWarning = null; //低温温度预警
|
|
|
109
|
+ TWarningThreshold wLowestWarning = null; //低温温度预警
|
|
109
|
110
|
String ilqYq = tTestdata.getIlqYq();
|
|
110
|
111
|
if (ilqYq.equals("0")) {
|
|
111
|
|
- threshold = warningThresholdService.getByCfCodeAndwName(house, 0, "6972", "6983");
|
|
112
|
|
- wLowest = warningThresholdService.getByCfCodeAndwName(house, 0, "6972", "6982");
|
|
113
|
|
- wWarning = warningThresholdService.getByCfCodeAndwName(house, 0, "6972", "6991");
|
|
|
112
|
+ threshold = warningThresholdService.getByCfCodeAndwName(house, 0, "6972", "6983");//获取高温报警阀值
|
|
|
113
|
+ wLowest = warningThresholdService.getByCfCodeAndwName(house, 0, "6972", "6982");//获取低温报警阀值
|
|
|
114
|
+ thresholdWarning = warningThresholdService.getByCfCodeAndwName(house, 0, "6972", "6991");//获取高温预警
|
|
|
115
|
+ wLowestWarning = warningThresholdService.getByCfCodeAndwName(house, 0, "6972", "7248");//低温温度预警
|
|
114
|
116
|
|
|
115
|
117
|
}
|
|
116
|
118
|
BigDecimal wholeSum = ps.stream().filter(TPoints -> !TPoints.getTemp().equals(new BigDecimal("250.0"))).map(TPoints::getTemp).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
@@ -139,22 +141,21 @@ public class GrainPushsServiceImpl implements GrainPushsService {
|
|
139
|
141
|
//用于判断是否已经报警
|
|
140
|
142
|
boolean temp = false;
|
|
141
|
143
|
BigDecimal wh = threshold.getThreshold();
|
|
142
|
|
- //-1 小于 0 等于 1 大于
|
|
|
144
|
+ //-1 小于 0 等于 1 大于 高温报警
|
|
143
|
145
|
if (wholeMax.compareTo(wh) == 1 && !wholeMax.toString().equals("250.0") && ilqYq.equals("0")) {
|
|
144
|
|
- String tid = uuidUtils.getCodeId(orgId, "t_warning_threshold_history");
|
|
|
146
|
+ String tid = UuidUtils.getCode();
|
|
145
|
147
|
String desc = "整仓粮温(" + wholeMax + ")高于阈值(" + wh + ")";
|
|
146
|
148
|
TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, threshold, wholeMax, wh, time, desc, dataSource2, "0", "0");
|
|
147
|
149
|
tWarningThresholdHistorieList.add(tt);
|
|
148
|
150
|
temp = true;
|
|
149
|
151
|
}
|
|
150
|
|
- if (wWarning != null && !temp && !wholeMax.toString().equals("250.0") && ilqYq.equals("0")) {
|
|
151
|
|
- //-1 小于 0 等于 1 大于
|
|
152
|
|
- BigDecimal ww = wWarning.getThreshold();
|
|
153
|
|
- BigDecimal subtract = wh.subtract(ww).setScale(2, RoundingMode.HALF_UP); //高温减去阈值
|
|
154
|
|
- if (wholeMax.compareTo(subtract) == 1 && ilqYq.equals("0")) {
|
|
155
|
|
- String tid = uuidUtils.getCodeId(orgId, "t_warning_threshold_history");
|
|
156
|
|
- String desc = "整仓粮温(" + wholeMax + ")高于阈值(" + subtract + ")";
|
|
157
|
|
- TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, wWarning, wholeMax, subtract, time, desc, dataSource2, "0", "1");
|
|
|
152
|
+ if (thresholdWarning != null && !temp && !wholeMax.toString().equals("250.0") && ilqYq.equals("0")) {
|
|
|
153
|
+ //-1 小于 0 等于 1 大于 高温预警
|
|
|
154
|
+ BigDecimal ww = thresholdWarning.getThreshold();
|
|
|
155
|
+ if (wholeMax.compareTo(ww) == 1 && ilqYq.equals("0")) {
|
|
|
156
|
+ String tid = UuidUtils.getCode();
|
|
|
157
|
+ String desc = "整仓粮温(" + wholeMax + ")高于阈值(" + ww + ")";
|
|
|
158
|
+ TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, thresholdWarning, wholeMax, ww, time, desc, dataSource2, "0", "1");
|
|
158
|
159
|
tWarningThresholdHistorieList.add(tt);
|
|
159
|
160
|
}
|
|
160
|
161
|
}
|
|
|
@@ -163,22 +164,21 @@ public class GrainPushsServiceImpl implements GrainPushsService {
|
|
163
|
164
|
//用于判断是否已经报警
|
|
164
|
165
|
boolean temp = false;
|
|
165
|
166
|
BigDecimal wl = wLowest.getThreshold().setScale(2, RoundingMode.HALF_UP);
|
|
166
|
|
- //-1 小于 0 等于 1 大于
|
|
|
167
|
+ //-1 小于 0 等于 1 大于 低温报警
|
|
167
|
168
|
if (wMin.compareTo(wl) == -1 && !wMin.toString().equals("250.0") && ilqYq.equals("0")) {
|
|
168
|
|
- String tid = uuidUtils.getCodeId(orgId, "t_warning_threshold_history");
|
|
|
169
|
+ String tid = UuidUtils.getCode();
|
|
169
|
170
|
String desc = "整仓粮温(" + wMin + ")低于阈值(" + wl + ")";
|
|
170
|
171
|
TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, wLowest, wMin, wl, time, desc, dataSource2, "0", "0");
|
|
171
|
172
|
tWarningThresholdHistorieList.add(tt);
|
|
172
|
173
|
temp = true;
|
|
173
|
174
|
}
|
|
174
|
|
- if (wWarning != null && !temp && !wMin.toString().equals("250.0") && ilqYq.equals("0")) {
|
|
175
|
|
- //-1 小于 0 等于 1 大于
|
|
176
|
|
- BigDecimal ww = wWarning.getThreshold();
|
|
177
|
|
- BigDecimal wadd = wl.add(ww);//高温减去阈值
|
|
178
|
|
- if (wMin.compareTo(wadd) == -1 && ilqYq.equals("0")) {
|
|
179
|
|
- String tid = uuidUtils.getCodeId(orgId, "t_warning_threshold_history");
|
|
180
|
|
- String desc = "整仓粮温(" + wMin + ")低于阈值(" + wadd + ")";
|
|
181
|
|
- TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, wWarning, wMin, wadd, time, desc, dataSource2, "0", "1");
|
|
|
175
|
+ if (wLowestWarning != null && !temp && !wMin.toString().equals("250.0") && ilqYq.equals("0")) {
|
|
|
176
|
+ //-1 小于 0 等于 1 大于 低温预警
|
|
|
177
|
+ BigDecimal ww = wLowestWarning.getThreshold();
|
|
|
178
|
+ if (wMin.compareTo(ww) == -1 && ilqYq.equals("0")) {
|
|
|
179
|
+ String tid = UuidUtils.getCode();
|
|
|
180
|
+ String desc = "整仓粮温(" + wMin + ")低于阈值(" + ww + ")";
|
|
|
181
|
+ TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, wLowestWarning, wMin, ww, time, desc, dataSource2, "0", "1");
|
|
182
|
182
|
tWarningThresholdHistorieList.add(tt);
|
|
183
|
183
|
}
|
|
184
|
184
|
}
|
|
|
@@ -211,7 +211,7 @@ public class GrainPushsServiceImpl implements GrainPushsService {
|
|
211
|
211
|
tTestdataLayer.setLmin(lsyerMin);
|
|
212
|
212
|
tTestdataLayer.setLhouse(house);
|
|
213
|
213
|
tTestdataLayer.setLtime(time);
|
|
214
|
|
- tTestdataLayer.setId(uuidUtils.getCodeId(orgId, "t_testdata_layer"));
|
|
|
214
|
+ tTestdataLayer.setId(UuidUtils.getCode());
|
|
215
|
215
|
tTestdataLayer.setOrgId(orgId);
|
|
216
|
216
|
tTestdataLayer.setDataSource(dataSource2);
|
|
217
|
217
|
tTestdataLayer.setLqId(testdataId);
|
|
|
@@ -232,23 +232,22 @@ public class GrainPushsServiceImpl implements GrainPushsService {
|
|
232
|
232
|
if (threshold != null && ilqYq.equals("0")) {
|
|
233
|
233
|
boolean temp = false;
|
|
234
|
234
|
BigDecimal threshold1 = threshold.getThreshold().setScale(2, RoundingMode.HALF_UP);
|
|
235
|
|
- //-1 小于 0 等于 1 大于
|
|
|
235
|
+ //-1 小于 0 等于 1 大于 高温报警
|
|
236
|
236
|
if (te.compareTo(threshold1) == 1 && !te.toString().equals("250.0")) {
|
|
237
|
237
|
// tid id,cfCdoe 仓房编码,threshold 报警实体包括orgID,tthreshold 检测值,wThreshold 预警或报警设置值,date 检测时间,desc 描述信息,mode 0测温,1测虫,2测气,warning 0报警,1预警
|
|
238
|
|
- String tid = uuidUtils.getCodeId(orgId, "t_warning_threshold_history");
|
|
|
238
|
+ String tid = UuidUtils.getCode();
|
|
239
|
239
|
String desc = "第" + keyL + "层,第" + keyR + "行,第" + keyC + "列粮温(" + te + ")高于阈值(" + threshold1 + ")";
|
|
240
|
240
|
TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, threshold, te, threshold1, time, desc, dataSource2, "0", "0");
|
|
241
|
241
|
tWarningThresholdHistorieList.add(tt);
|
|
242
|
242
|
temp = true;
|
|
243
|
243
|
}
|
|
244
|
|
- if (wWarning != null && !temp && !te.toString().equals("250.0")) {
|
|
245
|
|
- //-1 小于 0 等于 1 大于
|
|
246
|
|
- BigDecimal ww = wWarning.getThreshold();
|
|
247
|
|
- BigDecimal subtract = threshold1.subtract(ww).setScale(2, RoundingMode.HALF_UP); //高温减去阈值
|
|
248
|
|
- if (te.compareTo(subtract) == 1 && ilqYq.equals("0")) {
|
|
249
|
|
- String tid = uuidUtils.getCodeId(orgId, "t_warning_threshold_history");
|
|
250
|
|
- String desc = "第" + keyL + "层,第" + keyR + "行,第" + keyC + "列粮温(" + te + ")高于阈值(" + subtract + ")";
|
|
251
|
|
- TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, wWarning, te, subtract, time, desc, dataSource2, "0", "1");
|
|
|
244
|
+ if (thresholdWarning != null && !temp && !te.toString().equals("250.0")) {
|
|
|
245
|
+ //-1 小于 0 等于 1 大于 高温预警
|
|
|
246
|
+ BigDecimal ww = thresholdWarning.getThreshold();
|
|
|
247
|
+ if (te.compareTo(ww) == 1 && ilqYq.equals("0")) {
|
|
|
248
|
+ String tid = UuidUtils.getCode();
|
|
|
249
|
+ String desc = "第" + keyL + "层,第" + keyR + "行,第" + keyC + "列粮温(" + te + ")高于阈值(" + ww + ")";
|
|
|
250
|
+ TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, thresholdWarning, te, ww, time, desc, dataSource2, "0", "1");
|
|
252
|
251
|
tWarningThresholdHistorieList.add(tt);
|
|
253
|
252
|
}
|
|
254
|
253
|
}
|
|
|
@@ -256,22 +255,21 @@ public class GrainPushsServiceImpl implements GrainPushsService {
|
|
256
|
255
|
if (wLowest != null && ilqYq.equals("0")) {
|
|
257
|
256
|
boolean temp = false;
|
|
258
|
257
|
BigDecimal wl = wLowest.getThreshold().setScale(2, RoundingMode.HALF_UP);
|
|
259
|
|
- //-1 小于 0 等于 1 大于
|
|
|
258
|
+ //-1 小于 0 等于 1 大于 低温报警
|
|
260
|
259
|
if (te.compareTo(wl) == -1 && !te.toString().equals("250.0")) {
|
|
261
|
|
- String tid = uuidUtils.getCodeId(orgId, "t_warning_threshold_history");
|
|
|
260
|
+ String tid = UuidUtils.getCode();
|
|
262
|
261
|
String desc = "第" + keyL + "层,第" + keyR + "行,第" + keyC + "列粮温(" + te + ")低于阈值(" + wl + ")";
|
|
263
|
262
|
TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, wLowest, te, wl, time, desc, dataSource2, "0", "0");
|
|
264
|
263
|
tWarningThresholdHistorieList.add(tt);
|
|
265
|
264
|
temp = true;
|
|
266
|
265
|
}
|
|
267
|
|
- if (wWarning != null && !temp && !te.toString().equals("250.0")) {
|
|
268
|
|
- //-1 小于 0 等于 1 大于
|
|
269
|
|
- BigDecimal ww = wWarning.getThreshold();
|
|
270
|
|
- BigDecimal wadd = wl.add(ww).setScale(2, RoundingMode.HALF_UP);//高温减去阈值
|
|
271
|
|
- if (te.compareTo(wadd) == -1 && ilqYq.equals("0")) {
|
|
272
|
|
- String tid = uuidUtils.getCodeId(orgId, "t_warning_threshold_history");
|
|
273
|
|
- String desc = "第" + keyL + "层,第" + keyR + "行,第" + keyC + "列粮温(" + te + ")低于阈值(" + wadd + ")";
|
|
274
|
|
- TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, wWarning, te, wadd, time, desc, dataSource2, "0", "1");
|
|
|
266
|
+ if (wLowestWarning != null && !temp && !te.toString().equals("250.0")) {
|
|
|
267
|
+ //-1 小于 0 等于 1 大于 低温预警
|
|
|
268
|
+ BigDecimal ww = wLowestWarning.getThreshold();
|
|
|
269
|
+ if (te.compareTo(ww) == -1 && ilqYq.equals("0")) {
|
|
|
270
|
+ String tid = UuidUtils.getCode();
|
|
|
271
|
+ String desc = "第" + keyL + "层,第" + keyR + "行,第" + keyC + "列粮温(" + te + ")低于阈值(" + ww + ")";
|
|
|
272
|
+ TWarningThresholdHistory tt = warningMessage.saveWThreshold(tid, house, wLowestWarning, te, ww, time, desc, dataSource2, "0", "1");
|
|
275
|
273
|
tWarningThresholdHistorieList.add(tt);
|
|
276
|
274
|
}
|
|
277
|
275
|
}
|