|
@@ -178,24 +178,26 @@ public class CamelJDBCConfiguration {
|
178
|
178
|
.setBody(simple("SELECT distinct jh,max(rq),dym FROM DBA01 WHERE dym is not null group by jh,dym"))
|
179
|
179
|
.to("jdbc:oracle")
|
180
|
180
|
.split(body())
|
181
|
|
- .setBody(simple("update centralbase.cb_pc_pro_wellbore_status_daily set start_pump_liq_level = '${body[DYM]}' where well_id = '${body[JH]}' and prod_date::date = '${header.date}' "))
|
|
181
|
+ .setBody(simple("update centralbase.cb_pc_pro_wellbore_status_daily set start_pump_liq_level = '${body[DYM]}',dym_date ='${body[RQ]}' where well_id = '${body[JH]}' and prod_date::date = '${header.date}' and dym_date < '${body[RQ]}' "))
|
182
|
182
|
.doTry()
|
183
|
183
|
.to("jdbc:centralbase")
|
184
|
184
|
.doCatch(Exception.class)
|
185
|
185
|
.log("${header.date}"+" routeId:update-statusDaily-DYM -> centralbase.cb_pc_pro_wellbore_status_daily update data failed")
|
186
|
186
|
.end();
|
187
|
|
-
|
|
187
|
+ //因为数据库有可能会查出多条数据,现在的做法时,在数据库中增加两个个字段,用来记录BJ和DYM 的更新时间 ,只有获取到的时间大于数据库中存储的时间时,才会更新,并且该字段也会更新
|
188
|
188
|
from("timer:mytimer-update-statusDaily-BJ?period=1800000")
|
189
|
|
- .routeId("update-statusDaily-DYM")
|
|
189
|
+ .routeId("update-statusDaily-BJ")
|
190
|
190
|
.setHeader("date", constant(getDate() + " 00:00:00"))
|
191
|
|
- .setBody(simple("SELECT distinct jh,max(rq),bj FROM DBA01 WHERE dym is not null group by jh,dym"))
|
|
191
|
+ .setBody(simple("SELECT distinct jh,max(rq),bj FROM DBA01 WHERE bj is not null group by jh,bj"))
|
192
|
192
|
.to("jdbc:oracle")
|
193
|
|
- .split(body())
|
194
|
|
- .setBody(simple("update centralbase.cb_pc_pro_wellbore_status_daily set oil_nozzle = '${body[BJ]}' where well_id = '${body[JH]}' and prod_date::date = '${header.date}' "))
|
|
193
|
+ .split(body()).process(exchange -> {
|
|
194
|
+ HashMap body = exchange.getIn().getBody(HashMap.class);
|
|
195
|
+ })
|
|
196
|
+ .setBody(simple("update centralbase.cb_pc_pro_wellbore_status_daily set oil_nozzle = '${body[BJ]}',bj_date = '${body[RQ]}' where well_id = '${body[JH]}' and prod_date::date = '${header.date}' and bj_date < '${body[RQ]}' "))
|
195
|
197
|
.doTry()
|
196
|
198
|
.to("jdbc:centralbase")
|
197
|
199
|
.doCatch(Exception.class)
|
198
|
|
- .log("${header.date}"+" routeId:update-statusDaily-DYM -> centralbase.cb_pc_pro_wellbore_status_daily update data failed")
|
|
200
|
+ .log("${header.date}"+" routeId:update-statusDaily-BJ -> centralbase.cb_pc_pro_wellbore_status_daily update data failed")
|
199
|
201
|
.end();
|
200
|
202
|
|
201
|
203
|
from("timer:mytimer-update-statusDaily-submergenceDepth?period=1800000")
|