|
@@ -78,35 +78,7 @@ public class CamelJDBCCofRealTimeConfiguration {
|
78
|
78
|
return new RouteBuilder() {
|
79
|
79
|
@Override
|
80
|
80
|
public void configure() throws Exception {
|
81
|
|
- from("timer:mytimer-insert-mechDaily?period=3600000")
|
82
|
|
- .routeId("insert-mech_daily")
|
83
|
|
- .setHeader("date", constant(getDate()))
|
84
|
|
- .setBody(simple("select distinct jh,rq,dym,jy,ly,bj,bs,bx,zs,cc,cs,blx,dl from DBA01 where rq = to_date('${header.date}','yyyy-MM-dd') and qyrq is not null "))
|
85
|
|
- .to("jdbc:oracle")
|
86
|
|
- .split(body()).process(exchange -> {
|
87
|
|
- Message in = exchange.getIn();
|
88
|
|
- HashMap<String, Object> aRow = in.getBody(HashMap.class);
|
89
|
|
- if (aRow.get("JY") == null) aRow.put("JY", "0.0");
|
90
|
|
- if (aRow.get("LY") == null) aRow.put("LY", "0.0");
|
91
|
|
- if (aRow.get("BJ") == null) aRow.put("BJ", "0.0");
|
92
|
|
- if (aRow.get("BS") == null) aRow.put("BS", "0.0");
|
93
|
|
- if (aRow.get("BX") == null) aRow.put("BX", "0.0");
|
94
|
|
- if (aRow.get("ZS") == null) aRow.put("ZS", "0.0");
|
95
|
|
- if (aRow.get("CC") == null) aRow.put("CC", "0.0");
|
96
|
|
- if (aRow.get("CS") == null) aRow.put("CS", "0.0");
|
97
|
|
- if (aRow.get("BLX") == null) aRow.put("BLX", "");
|
98
|
|
- if (aRow.get("DL") == null) aRow.put("DL", "0.0");
|
99
|
|
- })
|
100
|
|
- .setBody(simple("insert into centralbase.cb_temp_well_mech_daily(well_id,prod_date,static_pressure,flow_pres,pump_diameter,pump_depth,pump_efficiency,rotate_frequency,stroke_length,stroke_frequency,pump_type,elec_frequency) " +
|
101
|
|
- "select '${body[JH]}','${body[RQ]}','${body[JY]}','${body[LY]}','${body[BJ]}','${body[BS]}','${body[BX]}','${body[ZS]}','${body[CC]}','${body[CS]}','${body[BLX]}','${body[DL]}' " +
|
102
|
|
- "where NOT EXISTS ( SELECT * FROM centralbase.cb_temp_well_mech_daily WHERE well_id = '${body[JH]}' and prod_date = '${body[RQ]}' )"))
|
103
|
|
- .doTry()
|
104
|
|
- .to("jdbc:centralbase")
|
105
|
|
- .doCatch(Exception.class)
|
106
|
|
- .log("${header.date}"+" routeId:insert-mech_daily -> centralbase.cb_temp_well_mech_daily insert data failed")
|
107
|
|
- .end();
|
108
|
|
-
|
109
|
|
- from("timer:mytimer-update-runTime?period=3600000")
|
|
81
|
+ /*from("timer:mytimer-update-runTime?period=3600000")
|
110
|
82
|
.routeId("update-runTime")
|
111
|
83
|
.setHeader("date", constant(getDate() + " 00:00:00"))
|
112
|
84
|
.setBody(simple("SELECT distinct jh,max(rq),bj FROM DBA01 WHERE dym is not null group by jh,bj"))
|
|
@@ -121,7 +93,7 @@ public class CamelJDBCCofRealTimeConfiguration {
|
121
|
93
|
.to("jdbc:centralbase")
|
122
|
94
|
.doCatch(Exception.class)
|
123
|
95
|
.log("${header.date}"+" routeId:update-runTime -> centralbase.cb_temp_well_mech_runtime update data failed")
|
124
|
|
- .end();
|
|
96
|
+ .end();*/
|
125
|
97
|
|
126
|
98
|
from("timer:mytimer-insert-runtimeAndSendToMQ?period=3600000")
|
127
|
99
|
.routeId("insert-runtimeAndSendToMQ")
|
|
@@ -189,7 +161,7 @@ public class CamelJDBCCofRealTimeConfiguration {
|
189
|
161
|
.log("${header.date}"+" routeId:insert-runtimeAndSendToMQ -> centralbase.cb_temp_well_mech_runtime insert data failed ${body}")
|
190
|
162
|
.end();
|
191
|
163
|
|
192
|
|
- from("timer:mytimer-update-avg-mech_daily?period=3600000")
|
|
164
|
+ from("timer:mytimer-update-avg-mech_daily?period=1800000")
|
193
|
165
|
.routeId("update-avg-mech_daily")
|
194
|
166
|
.setHeader("date", constant(getDate()))
|
195
|
167
|
.setBody(simple("select well_id,avg(stroke_length) stroke_length ,avg(stroke_frequency) stroke_frequency from centralbase.cb_temp_well_mech_runtime where prod_date::date='${header.date}' group by well_id"))
|
|
@@ -214,6 +186,34 @@ public class CamelJDBCCofRealTimeConfiguration {
|
214
|
186
|
.doCatch(Exception.class)
|
215
|
187
|
.log("${header.date}"+" routeId:update-avg-mech_daily -> centralbase.cb_temp_well_mech_daily update data failed")
|
216
|
188
|
.end();
|
|
189
|
+
|
|
190
|
+ from("timer:mytimer-insert-mechDaily?period=3600000")
|
|
191
|
+ .routeId("insert-mech_daily")
|
|
192
|
+ .setHeader("date", constant(getDate()))
|
|
193
|
+ .setBody(simple("select distinct jh,rq,dym,jy,ly,bj,bs,bx,zs,cc,cs,blx,dl from DBA01 where rq = to_date('${header.date}','yyyy-MM-dd') and qyrq is not null "))
|
|
194
|
+ .to("jdbc:oracle")
|
|
195
|
+ .split(body()).process(exchange -> {
|
|
196
|
+ Message in = exchange.getIn();
|
|
197
|
+ HashMap<String, Object> aRow = in.getBody(HashMap.class);
|
|
198
|
+ if (aRow.get("JY") == null) aRow.put("JY", "0.0");
|
|
199
|
+ if (aRow.get("LY") == null) aRow.put("LY", "0.0");
|
|
200
|
+ if (aRow.get("BJ") == null) aRow.put("BJ", "0.0");
|
|
201
|
+ if (aRow.get("BS") == null) aRow.put("BS", "0.0");
|
|
202
|
+ if (aRow.get("BX") == null) aRow.put("BX", "0.0");
|
|
203
|
+ if (aRow.get("ZS") == null) aRow.put("ZS", "0.0");
|
|
204
|
+ if (aRow.get("CC") == null) aRow.put("CC", "0.0");
|
|
205
|
+ if (aRow.get("CS") == null) aRow.put("CS", "0.0");
|
|
206
|
+ if (aRow.get("BLX") == null) aRow.put("BLX", "");
|
|
207
|
+ if (aRow.get("DL") == null) aRow.put("DL", "0.0");
|
|
208
|
+ })
|
|
209
|
+ .setBody(simple("insert into centralbase.cb_temp_well_mech_daily(well_id,prod_date,static_pressure,flow_pres,pump_diameter,pump_depth,pump_efficiency,rotate_frequency,stroke_length,stroke_frequency,pump_type,elec_frequency) " +
|
|
210
|
+ "select '${body[JH]}','${body[RQ]}','${body[JY]}','${body[LY]}','${body[BJ]}','${body[BS]}','${body[BX]}','${body[ZS]}','${body[CC]}','${body[CS]}','${body[BLX]}','${body[DL]}' " +
|
|
211
|
+ "where NOT EXISTS ( SELECT * FROM centralbase.cb_temp_well_mech_daily WHERE well_id = '${body[JH]}' and prod_date = '${body[RQ]}' )"))
|
|
212
|
+ .doTry()
|
|
213
|
+ .to("jdbc:centralbase")
|
|
214
|
+ .doCatch(Exception.class)
|
|
215
|
+ .log("${header.date}"+" routeId:insert-mech_daily -> centralbase.cb_temp_well_mech_daily insert data failed")
|
|
216
|
+ .end();
|
217
|
217
|
};
|
218
|
218
|
};
|
219
|
219
|
}
|