|
|
@@ -12,13 +12,13 @@ import java.util.stream.Collectors;
|
|
12
|
12
|
|
|
13
|
13
|
import javax.annotation.Resource;
|
|
14
|
14
|
|
|
|
15
|
+import org.apache.commons.lang3.StringUtils;
|
|
15
|
16
|
import org.slf4j.Logger;
|
|
16
|
17
|
import org.slf4j.LoggerFactory;
|
|
17
|
18
|
import org.springframework.context.annotation.Configuration;
|
|
18
|
19
|
import org.springframework.transaction.annotation.Transactional;
|
|
19
|
20
|
|
|
20
|
21
|
import com.chinaitop.depot.intelligent.basicdata.model.SysSerial;
|
|
21
|
|
-import com.chinaitop.depot.intelligent.basicdata.model.TWarningThreshold;
|
|
22
|
22
|
import com.chinaitop.depot.intelligent.basicdata.service.SysSerialService;
|
|
23
|
23
|
import com.chinaitop.depot.intelligent.basicdata.service.WarningThresholdService;
|
|
24
|
24
|
import com.chinaitop.depot.intelligent.grainsituation.mapper.TTestdataLayerMapper;
|
|
|
@@ -30,7 +30,6 @@ import com.chinaitop.depot.intelligent.grainsituation.model.TTestdata;
|
|
30
|
30
|
import com.chinaitop.depot.intelligent.grainsituation.model.TTestdataLayer;
|
|
31
|
31
|
import com.chinaitop.depot.intelligent.grainsituation.model.TTestdataLog;
|
|
32
|
32
|
import com.chinaitop.depot.intelligent.grainsituation.model.TTestdataPoints;
|
|
33
|
|
-import com.chinaitop.depot.intelligent.grainsituation.model.TWarningThresholdHistory;
|
|
34
|
33
|
import com.chinaitop.depot.intelligent.grainsituation.service.TemperatureRecordService;
|
|
35
|
34
|
import com.google.common.collect.Lists;
|
|
36
|
35
|
|
|
|
@@ -110,16 +109,17 @@ public class LongRangeUtils {
|
|
110
|
109
|
List<Date> cTimes = tts.stream().map(TTestdata::getTime).collect(Collectors.toList());
|
|
111
|
110
|
List<String> lqTypes = tts.stream().map(TTestdata::getIlqYq).collect(Collectors.toList());
|
|
112
|
111
|
//校验重复数据
|
|
113
|
|
- List<TTestdata> byCodeAndTimes = temperatureRecordService.getByCodeAndTimes(cDcsCodes, cTimes, lqTypes);
|
|
114
|
|
- if (byCodeAndTimes != null && byCodeAndTimes.size() > INT_ZERO) {
|
|
115
|
|
- logger.info("上传数据重复!");
|
|
116
|
|
- return;
|
|
117
|
|
- }
|
|
118
|
|
- String orgId = temperatureRecordService.getOrgId(cDcsCodes.get(INT_ZERO));
|
|
119
|
|
- if (null != orgId && !"".equals(orgId)) {
|
|
120
|
|
- ts.forEach(obj -> {
|
|
|
112
|
+// List<TTestdata> byCodeAndTimes = temperatureRecordService.getByCodeAndTimes(cDcsCodes, cTimes, lqTypes);
|
|
|
113
|
+// if (byCodeAndTimes != null && byCodeAndTimes.size() > INT_ZERO) {
|
|
|
114
|
+// logger.info("上传数据重复!");
|
|
|
115
|
+// return;
|
|
|
116
|
+// }
|
|
|
117
|
+// String orgId = temperatureRecordService.getOrgId(cDcsCodes.get(INT_ZERO));
|
|
|
118
|
+// if (null != orgId && !"".equals(orgId)) {
|
|
|
119
|
+ for (int i = 0; i < ts.size(); i++) {
|
|
|
120
|
+ //ts.forEach(obj -> {
|
|
121
|
121
|
String testdataId = UuidUtils.getCode();
|
|
122
|
|
- TTestdata tTestdata = (TTestdata) obj;
|
|
|
122
|
+ TTestdata tTestdata = (TTestdata) ts.get(i);
|
|
123
|
123
|
String house = tTestdata.getStorehouse();
|
|
124
|
124
|
Date time = tTestdata.getTime();
|
|
125
|
125
|
List<TPoints> ps = tTestdata.getPoints();
|
|
|
@@ -135,6 +135,20 @@ public class LongRangeUtils {
|
|
135
|
135
|
.replace("x:", "")
|
|
136
|
136
|
.replace("y:", "")
|
|
137
|
137
|
.replace("z:", "");
|
|
|
138
|
+
|
|
|
139
|
+ //检查仓房编号是否可识别
|
|
|
140
|
+ String orgId = temperatureRecordService.getOrgId(house);
|
|
|
141
|
+ if (StringUtils.isBlank(orgId)) {
|
|
|
142
|
+ logger.info("仓房编号为"+house+"的数据无法识别,所以跳过不保存!");
|
|
|
143
|
+ continue;
|
|
|
144
|
+ }
|
|
|
145
|
+ //校验重复数据
|
|
|
146
|
+ List<TTestdata> byCodeAndTimes = temperatureRecordService.findByConditions(house, time, tTestdata.getIlqYq());
|
|
|
147
|
+ if (byCodeAndTimes != null && byCodeAndTimes.size() > INT_ZERO) {
|
|
|
148
|
+ logger.info("storehouse为"+house+",time为"+ParameterUtil.date2YMDHMS(time)+",ilqYq为"+tTestdata.getIlqYq()+"的数据已存在,所以不保存!");
|
|
|
149
|
+ continue;
|
|
|
150
|
+ }
|
|
|
151
|
+
|
|
138
|
152
|
//获取报警阈值信息6972测温 6983温度高限 6982温度底限 6991温度预警
|
|
139
|
153
|
// TWarningThreshold threshold = null; //温度高限
|
|
140
|
154
|
// TWarningThreshold wLowest = null; //温度底限
|
|
|
@@ -396,7 +410,7 @@ public class LongRangeUtils {
|
|
396
|
410
|
}
|
|
397
|
411
|
}*/
|
|
398
|
412
|
}
|
|
399
|
|
- });
|
|
|
413
|
+ }
|
|
400
|
414
|
if (tTestdataList.size() > INT_ZERO) {
|
|
401
|
415
|
temperatureRecordService.insertBatch(tTestdataList);
|
|
402
|
416
|
}
|
|
|
@@ -410,9 +424,10 @@ public class LongRangeUtils {
|
|
410
|
424
|
tTestdataPointsMapper.insertBatch(points_list);
|
|
411
|
425
|
}
|
|
412
|
426
|
logger.info("测温数据入库业务表成功");
|
|
413
|
|
- } else {
|
|
414
|
|
- logger.info("返回数据后存储异常:未获取到orgId值,所以不保存数据!");
|
|
415
|
|
- }
|
|
|
427
|
+// }
|
|
|
428
|
+// else {
|
|
|
429
|
+// logger.info("返回数据后存储异常:未获取到orgId值,所以不保存数据!");
|
|
|
430
|
+// }
|
|
416
|
431
|
|
|
417
|
432
|
} catch (Exception e) {
|
|
418
|
433
|
logger.info("测温异常:" + e.getMessage());
|