Browse Source

bug xiugai

gxt 3 years ago
parent
commit
881f42292c

+ 1 - 5
pom.xml

@@ -101,7 +101,7 @@
101 101
         </dependency>
102 102
         <dependency>
103 103
             <groupId>org.springframework.boot</groupId>
104
-            <artifactId>spring-boot-starter-web</artifactId>
104
+            <artifactId>spring-boot-starter-actuator</artifactId>
105 105
         </dependency>
106 106
 <!--        <dependency>-->
107 107
 <!--            <groupId>org.springframework.boot</groupId>-->
@@ -117,10 +117,6 @@
117 117
         </dependency>
118 118
         <dependency>
119 119
             <groupId>org.apache.camel.springboot</groupId>
120
-            <artifactId>camel-rest-starter</artifactId>
121
-        </dependency>
122
-        <dependency>
123
-            <groupId>org.apache.camel.springboot</groupId>
124 120
             <artifactId>camel-file-starter</artifactId>
125 121
         </dependency>
126 122
         <dependency>

+ 3 - 3
src/main/java/com/gct/tools/etlcamelhuge/controller/GtController.java

@@ -55,14 +55,14 @@ public class GtController {
55 55
         jdbcTemplate = new JdbcTemplate(dataSource);
56 56
         long sumData = 0;
57 57
         try {
58
-                if (wellList.isEmpty() || wellList.size()==0 ){
58
+                if (wellList.isEmpty()){
59 59
                     String sql = String.format("select so.well_id,so.well_common_name,so.org_id,ti.prod_date,ti.stroke_frequency,ti.stroke_length,ti.sgt from centralbase.cb_temp_well_mech_runtime ti, centralbase.cb_cd_well_source so " +
60 60
                             " where ti.well_id = so.well_id  and ti.prod_date between '%s' and '%s' " ,startDate,endDate);
61 61
                     sumData = sendDataToMQ(sql);
62 62
                 }else {
63
-                    for (int i = 0; i < wellList.size(); i++) {
63
+                    for (String s : wellList) {
64 64
                         String sql = String.format("select so.well_id,so.well_common_name,so.org_id,ti.prod_date,ti.stroke_frequency,ti.stroke_length,ti.sgt from centralbase.cb_temp_well_mech_runtime ti, centralbase.cb_cd_well_source so " +
65
-                                " where ti.well_id = so.well_id and ti.well_id = '%s' and ti.prod_date between '%s' and '%s' ", wellList.get(i), startDate, endDate);
65
+                                " where ti.well_id = so.well_id and ti.well_id = '%s' and ti.prod_date between '%s' and '%s' ", s, startDate, endDate);
66 66
                         sumData = sendDataToMQ(sql);
67 67
                     }
68 68
                 }

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

@@ -54,7 +54,7 @@ public class CamelInsertA2Configuration {
54 54
                             Timestamp timestamp = (Timestamp) aRow.get("prod_date");
55 55
                             Instant instant = Instant.ofEpochMilli(timestamp.getTime());
56 56
                             LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
57
-                            aRow.put("prod_date",localDateTime.toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
57
+                            aRow.put("prod_date",localDateTime.minusDays(1).toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
58 58
                         })
59 59
                         .setBody(simple(" insert into DMS_DBA01_RCYL (JH, RQ, RCYL) values('${body[well_id]}', to_date(to_char('${body[prod_date]}'),'yyyy-MM-dd'),'${body[liq_prod_daily]}') "))
60 60
                         .to("jdbc:insertA2")
@@ -63,6 +63,6 @@ public class CamelInsertA2Configuration {
63 63
         };
64 64
     }
65 65
     private String getDate(){
66
-        return  LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
66
+        return  LocalDateTime.now().minusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
67 67
     }
68 68
 }