Преглед изворни кода

bj,dym 重复导入不是最新问题解决-3

gxt пре 3 година
родитељ
комит
1e0865e97e

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

@@ -58,7 +58,7 @@ public class BaseDataController {
58 58
                 sql = "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) " +
59 59
                         "values (?,?,?,?,?,?,?,?)";
60 60
                 insertCount = insertBaseDataSourceOfStatusDaily(sql, map);
61
-                sql = "select jh , rq , dym from centralbase.cb_pc_pro_wellbore_status_daily where  (jh,rq) in (SELECT  jh,max(rq) rq  FROM DBA01 WHERE dym is not null and to_date('"+date+"','yyyy-MM-dd') group by jh)";
61
+                sql = "select  distinct jh , rq , dym from DBA01 where  (jh,rq) in (SELECT  jh,max(rq) rq  FROM DBA01 WHERE dym is not null and rq<=to_date('"+date+"','yyyy-MM-dd') group by jh)";
62 62
                 List<Map<String, Object>> dymIsNotNUllList = selectA2DataOfNotIsNullDYMOrBJ(sql);
63 63
                 for (Map<String, Object> stringObjectMap : dymIsNotNUllList) {
64 64
                     sql = "update centralbase.cb_pc_pro_wellbore_status_daily set start_pump_liq_level = '" + stringObjectMap.get("DYM") + "' where well_id = '" + stringObjectMap.get("JH") + "' and prod_date::date  = '" + stringObjectMap.get("RQ") + "' ";
@@ -78,7 +78,7 @@ public class BaseDataController {
78 78
                     sql = " update centralbase.cb_pc_pro_wellbore_status_daily set submergence_depth = '" + stringObjectMap.get("submergence_depth") + "' where well_id = '" + stringObjectMap.get("well_id") + "' and prod_date  = '" + stringObjectMap.get("prod_date") + "' ";
79 79
                     updateCMDCount = updateBaseDataSourceOfStatusDaily(sql) + updateCMDCount;
80 80
                 }
81
-                sql = "select jh , rq , bj from centralbase.cb_pc_pro_wellbore_status_daily where  (jh,rq) in (SELECT  jh,max(rq) rq  FROM DBA01 WHERE bj is not null and to_date('"+date+"','yyyy-MM-dd') group by jh)";
81
+                sql = "select distinct jh , rq , bj from DBA01 where  (jh,rq) in (SELECT  jh,max(rq) rq  FROM DBA01 WHERE bj is not null and rq<= to_date('"+date+"','yyyy-MM-dd') group by jh)";
82 82
                 List<Map<String, Object>> oilNozzleList = selectA2DataOfNotIsNullDYMOrBJ(sql);
83 83
                 for (Map<String, Object> stringObjectMap : oilNozzleList) {
84 84
                     sql = " update centralbase.cb_pc_pro_wellbore_status_daily set oil_nozzle = '" + stringObjectMap.get("BJ") + "' where well_id ='" + stringObjectMap.get("JH") + "' and prod_date='" + stringObjectMap.get("RQ") + "' ";

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

@@ -95,9 +95,9 @@ public class CamelJDBCCofRealTimeConfiguration  {
95 95
                         .log("${header.date}"+" routeId:update-runTime -> centralbase.cb_temp_well_mech_runtime update data failed")
96 96
                         .end();*/
97 97
 
98
-                from("timer:mytimer-insert-runtimeAndSendToMQ?period=3600000")
98
+                from("timer:mytimer-insert-runtimeAndSendToMQ?period=1800000")
99 99
                         .routeId("insert-runtimeAndSendToMQ")
100
-                        .setBody(simple("select max(prod_date) from centralbase.cb_temp_well_mech_runtime "))
100
+                        .setBody(simple("select max(prod_date)  from centralbase.cb_temp_well_mech_runtime "))
101 101
                         .to("jdbc:centralbase")
102 102
                         .split(body())
103 103
                         .setHeader("date", simple("${body[max]}"))
@@ -105,7 +105,7 @@ public class CamelJDBCCofRealTimeConfiguration  {
105 105
                         .doTry()
106 106
                         .to("jdbc:gtsj")
107 107
                         .doCatch(Exception.class)
108
-                        .log("${deader.date}" + " routeId:insert-runtimeAndSendToMQ -> select runTime data failed")
108
+                        .log("${header.date}" + " routeId:insert-runtimeAndSendToMQ -> select runTime data failed")
109 109
                         .process(exchange -> {
110 110
                             sendMsgRunTime = 0;
111 111
                         })

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

@@ -175,7 +175,7 @@ public class CamelJDBCConfiguration {
175 175
                 from("timer:mytimer-update-statusDaily-DYM?period=3600000")
176 176
                         .routeId("update-statusDaily-DYM")
177 177
                         .setHeader("date", constant(getDate()))
178
-                        .setBody(simple("select jh , rq , dym from centralbase.cb_pc_pro_wellbore_status_daily where  (jh,rq) in (SELECT  jh,max(rq) rq  FROM DBA01 WHERE dym is not null and to_date('${header.date}','yyyy-MM-dd') group by jh)"))
178
+                        .setBody(simple("select distinct jh , rq , dym from DBA01 where  (jh,rq) in (SELECT  jh,max(rq) rq  FROM DBA01 WHERE dym is not null and rq<= to_date('${header.date}','yyyy-MM-dd') group by jh)"))
179 179
                         .to("jdbc:oracle")
180 180
                         .split(body())
181 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}' "))
@@ -188,7 +188,7 @@ public class CamelJDBCConfiguration {
188 188
                 from("timer:mytimer-update-statusDaily-BJ?period=3600000")
189 189
                         .routeId("update-statusDaily-BJ")
190 190
                         .setHeader("date", constant(getDate()))
191
-                        .setBody(simple("select jh , rq , bj from centralbase.cb_pc_pro_wellbore_status_daily where  (jh,rq) in (SELECT  jh,max(rq) rq  FROM DBA01 WHERE bj is not null and to_date('${header.date}','yyyy-MM-dd') group by jh)"))
191
+                        .setBody(simple("select distinct jh , rq , bj from DBA01 where  (jh,rq) in (SELECT  jh,max(rq) rq  FROM DBA01 WHERE bj is not null and rq<= to_date('${header.date}','yyyy-MM-dd') group by jh)"))
192 192
                         .to("jdbc:oracle")
193 193
                         .split(body()).process(exchange -> {
194 194
                             HashMap body = exchange.getIn().getBody(HashMap.class);
@@ -307,7 +307,7 @@ public class CamelJDBCConfiguration {
307 307
                         .to("jdbc:centralbase")
308 308
                         .end();
309 309
 
310
-                from("timer:mytimer-update-volDaily-liq_prod_daily?period=1800000")
310
+                from("timer:mytimer-update-volDaily-liq_prod_daily?period=3600000")
311 311
                         .routeId("update-volDaily-liq_prod_daily")
312 312
                         .setHeader("date", constant(getDate()))
313 313
                         .setBody(simple("select distinct  jh,rq,scsj, rcyl1,rcyl,rcql,hs, bz from DBA01 where rq  = to_date('${header.date}','yyyy-MM-dd') and qyrq is not null "))