|
@@ -67,7 +67,15 @@ public class ModbusReadService {
|
67
|
67
|
List<List<Double>> sgt = readBody.card;
|
68
|
68
|
Double s = readBody.s;
|
69
|
69
|
Double n = readBody.n;
|
70
|
|
- String prodTime = readBody.prodTime;
|
|
70
|
+ String prodTime = LocalDateTime.now().format(df);
|
|
71
|
+ String checkTime = readBody.prodTime;
|
|
72
|
+ //bh data read save
|
|
73
|
+ BHModbusDataBody bhModbusDataBody = ModbusRTUReader.readBHBody();
|
|
74
|
+ BhRtuData data = JSONObject.toJavaObject((JSON) JSONObject.toJSON(bhModbusDataBody), BhRtuData.class);
|
|
75
|
+ data.setWellId(aoidConfigData.getJh());
|
|
76
|
+ data.setProdDate(prodTime);
|
|
77
|
+ bhRtuDataService.save(data);
|
|
78
|
+
|
71
|
79
|
if (Objects.isNull(sgt) || Objects.isNull(s) || Objects.isNull(n) ||Objects.isNull(prodTime) || s < 1e-6 || n < 1e-6) {
|
72
|
80
|
log.error("read Rtu modbus failed, sgt: {},s: {},n: {},prodTime: {}", sgt, s, n, prodTime);
|
73
|
81
|
continue;
|
|
@@ -78,12 +86,12 @@ public class ModbusReadService {
|
78
|
86
|
if (Objects.isNull(lastDumpRecord)){
|
79
|
87
|
lastDumpRecord = new DumpRecord();
|
80
|
88
|
lastDumpRecord.setTableName(aoidConfigData.getJh());
|
81
|
|
- lastDumpRecord.setDumpTime(prodTime);
|
|
89
|
+ lastDumpRecord.setDumpTime(checkTime);
|
82
|
90
|
dumpRecordService.save(lastDumpRecord);
|
83
|
91
|
}else {
|
84
|
|
- if (lastDumpRecord.getDumpTime().equals(prodTime))continue;
|
|
92
|
+ if (lastDumpRecord.getDumpTime().equals(checkTime))continue;
|
85
|
93
|
else {
|
86
|
|
- lastDumpRecord.setDumpTime(prodTime);
|
|
94
|
+ lastDumpRecord.setDumpTime(checkTime);
|
87
|
95
|
dumpRecordService.update(lastDumpRecord,new QueryWrapper<DumpRecord>().eq("table_name", aoidConfigData.getJh()));
|
88
|
96
|
}
|
89
|
97
|
}
|
|
@@ -97,12 +105,7 @@ public class ModbusReadService {
|
97
|
105
|
executor.submit(new CalculateInputData(aoidConfigData.getJh(), LocalDateTime.parse(prodTime, df), s, n, sgtDouble));
|
98
|
106
|
|
99
|
107
|
|
100
|
|
- //bh data read save
|
101
|
|
- BHModbusDataBody bhModbusDataBody = ModbusRTUReader.readBHBody();
|
102
|
|
- BhRtuData data = JSONObject.toJavaObject((JSON) JSONObject.toJSON(bhModbusDataBody), BhRtuData.class);
|
103
|
|
- data.setWellId(aoidConfigData.getJh());
|
104
|
|
- data.setProdDate(prodTime);
|
105
|
|
- bhRtuDataService.save(data);
|
|
108
|
+
|
106
|
109
|
} catch (Exception e) {
|
107
|
110
|
log.error("readDataAndSubmitTask error, detail: {}, cause: {}", e.getMessage(),e.getCause());
|
108
|
111
|
}
|