Browse Source

bug fix 并且将之前的一小时执行一次修改为3小时一次

gxt 3 years ago
parent
commit
05b37446d1

+ 2 - 0
src/main/java/com/gct/tools/etlcamelhuge/controller/BaseDataController.java

@@ -210,7 +210,9 @@ public class BaseDataController {
210 210
         JSONObject jsonObject = new JSONObject();
211 211
         jdbcTemplate = new JdbcTemplate(gtsjDataSource);
212 212
         try{
213
+            long st = System.currentTimeMillis();
213 214
             List<Map<String, Object>> list = jdbcTemplate.queryForList(baseDataBody.getSql());
215
+            jsonObject.put("cost",(System.currentTimeMillis()-st)+" ms");
214 216
             jsonObject.put("RunTimedata",list);
215 217
         }catch (Exception e){
216 218
             jsonObject.put("error",e.getMessage());

+ 2 - 2
src/main/java/com/gct/tools/etlcamelhuge/routeconfig/CamelJDBCCofRealTimeConfiguration.java

@@ -78,7 +78,7 @@ public class CamelJDBCCofRealTimeConfiguration  {
78 78
                             exchange.getIn().setHeader("well_id",body.get("well_id"));
79 79
                             exchange.getIn().setHeader("sgt_last_time",body.get("sgt_last_time"));
80 80
                         })
81
-                        .setBody(simple("select distinct well_name,dyna_create_time,check_date,displacement,disp_load,stroke,frequency,susp_max_load,susp_min_load from public.pc_fd_pumpjack_dyna_dia_t where   dyna_create_time >= '${header.sgt_last_time}' and well_name='${header.well_id}' "))
81
+                        .setBody(simple("select distinct well_name,dyna_create_time,check_date,displacement,disp_load,stroke,frequency,susp_max_load,susp_min_load from public.pc_fd_pumpjack_dyna_dia_t where   dyna_create_time >= '${header.sgt_last_time}' and well_name='${header.well_id}' limit 50 "))
82 82
                         .to("jdbc:gtsj")
83 83
                         .process(exchange -> {
84 84
                             sendMsgRunTime = 0;
@@ -160,7 +160,7 @@ public class CamelJDBCCofRealTimeConfiguration  {
160 160
                         .to("jdbc:centralbase")
161 161
                         .end();
162 162
 
163
-               from("timer:mytimer-update-avg-mech_daily?period=3600000")
163
+               from("timer:mytimer-update-avg-mech_daily?period=10800000")
164 164
                         .routeId("update-avg-mech_daily")
165 165
                        .process(exchange -> {
166 166
                            Message in = exchange.getIn();

+ 10 - 9
src/main/java/com/gct/tools/etlcamelhuge/routeconfig/CamelJDBCConfiguration.java

@@ -187,26 +187,27 @@ public class CamelJDBCConfiguration {
187 187
                         .end();
188 188
 
189 189
 
190
-                RouteDefinition statusDaily= from("timer:mytimer-insert-statusDaily?period=3600000")
190
+                RouteDefinition statusDaily= from("timer:mytimer-insert-statusDaily?period=10800000")
191 191
                         .routeId("insert-statusDaily")
192 192
                         .process(exchange -> {
193 193
                             Message in = exchange.getIn();
194 194
                             in.setHeader("date",getDate());
195 195
                         });
196 196
                          setMyBody(statusDaily)
197
-                        .setBody(simple("select  distinct jh,rq,cyfs,yz,hysx , yysx ,tysx,bs,dym from DBA01 where rq  = to_date('${header.date}','yyyy-MM-dd') and jh='${header.well_id}' and qyrq is not null "))
197
+                        .setBody(simple("select  distinct jh,rq,cyfs,yz,hysx ,bj, yysx ,tysx,bs,dym from DBA01 where rq  = to_date('${header.date}','yyyy-MM-dd') and jh='${header.well_id}' and qyrq is not null "))
198 198
                         .to("jdbc:oracle")
199 199
                         .split(body()).process(exchange -> {
200 200
                     Message in = exchange.getIn();
201 201
                     HashMap<String, Object> aRow = in.getBody(HashMap.class);
202 202
                     if (aRow.get("YZ") == null) aRow.put("YZ", "0.0");
203
+                    if (aRow.get("BJ") == null) aRow.put("BJ", "0.0");
203 204
                     if (aRow.get("HYSX") == null) aRow.put("HYSX", "0.0");
204 205
                     if (aRow.get("YYSX") == null) aRow.put("YYSX", "0.0");
205 206
                     if (aRow.get("TYSX") == null) aRow.put("TYSX", "0.0");
206 207
                     if (aRow.get("BS") == null) aRow.put("BS", "0.0");
207 208
                 })
208 209
                         .setBody(simple("insert into centralbase.cb_pc_pro_wellbore_status_daily(well_id,prod_date,oil_prod_method,oil_nozzle,back_pres,tubing_pres,casing_pres,pump_depth) " +
209
-                                "select '${body[JH]}','${body[RQ]}','${body[CYFS]}','${body[YZ]}','${body[HYSX]}','${body[YYSX]}','${body[TYSX]}','${body[BS]}' " +
210
+                                "select '${body[JH]}','${body[RQ]}','${body[CYFS]}','${body[BJ]}','${body[HYSX]}','${body[YYSX]}','${body[TYSX]}','${body[BS]}' " +
210 211
                                 "where NOT EXISTS ( SELECT * FROM centralbase.cb_pc_pro_wellbore_status_daily WHERE well_id = '${body[JH]}' and  prod_date = '${body[RQ]}')"))
211 212
                         .doTry()
212 213
                         .to("jdbc:centralbase")
@@ -215,7 +216,7 @@ public class CamelJDBCConfiguration {
215 216
                         .end();
216 217
 
217 218
 
218
-                RouteDefinition statusDailyDYM = from("timer:mytimer-update-statusDaily-DYM?period=3600000")
219
+                RouteDefinition statusDailyDYM = from("timer:mytimer-update-statusDaily-DYM?period=10800000")
219 220
                         .routeId("update-statusDaily-DYM")
220 221
                         .process(exchange -> {
221 222
                             Message in = exchange.getIn();
@@ -231,7 +232,7 @@ public class CamelJDBCConfiguration {
231 232
                         .doCatch(Exception.class)
232 233
                         .log("${header.date}"+" routeId:update-statusDaily-DYM ->  centralbase.cb_pc_pro_wellbore_status_daily update data failed")
233 234
                         .end();
234
-                RouteDefinition statusDailyBJ = from("timer:mytimer-update-statusDaily-BJ?period=3600000")
235
+               /* RouteDefinition statusDailyBJ = from("timer:mytimer-update-statusDaily-BJ?period=3600000")
235 236
                         .routeId("update-statusDaily-BJ")
236 237
                         .process(exchange -> {
237 238
                             Message in = exchange.getIn();
@@ -248,9 +249,9 @@ public class CamelJDBCConfiguration {
248 249
                         .to("jdbc:centralbase")
249 250
                         .doCatch(Exception.class)
250 251
                         .log("${header.date}"+" routeId:update-statusDaily-BJ ->  centralbase.cb_pc_pro_wellbore_status_daily update data failed")
251
-                        .end();
252
+                        .end();*/
252 253
 
253
-                RouteDefinition submergenceDepth = from("timer:mytimer-update-statusDaily-submergenceDepth?period=3600000")
254
+                RouteDefinition submergenceDepth = from("timer:mytimer-update-statusDaily-submergenceDepth?period=10800000")
254 255
                         .routeId("update-statusDaily-submergenceDepth")
255 256
                         .process(exchange -> {
256 257
                             Message in = exchange.getIn();
@@ -277,7 +278,7 @@ public class CamelJDBCConfiguration {
277 278
                         .log("${header.date}"+" routeId:update-statusDaily-submergenceDepth ->  centralbase.cb_pc_pro_wellbore_status_daily update data failed")
278 279
                         .end();
279 280
 
280
-                RouteDefinition volDaily = from("timer:mytimer-insert-volDaily?period=3600000")
281
+                RouteDefinition volDaily = from("timer:mytimer-insert-volDaily?period=10800000")
281 282
                         .routeId("insert-volDaily")
282 283
                         .process(exchange -> {
283 284
                             Message in = exchange.getIn();
@@ -345,7 +346,7 @@ public class CamelJDBCConfiguration {
345 346
                         .to("jdbc:centralbase")
346 347
                         .end();
347 348
 
348
-                RouteDefinition volDailyLiqProdDaily = from("timer:mytimer-update-volDaily-liq_prod_daily?period=3600000")
349
+                RouteDefinition volDailyLiqProdDaily = from("timer:mytimer-update-volDaily-liq_prod_daily?period=10800000")
349 350
                         .routeId("update-volDaily-liq_prod_daily")
350 351
                         .process(exchange -> {
351 352
                             Message in = exchange.getIn();