Browse Source

zd bug fix

xsr 11 months ago
parent
commit
0330e6d82b

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

@@ -168,7 +168,10 @@ public class CamelJDBCConfiguration {
168
                         .split(body())
168
                         .split(body())
169
                         .split(body()).process(exchange -> {
169
                         .split(body()).process(exchange -> {
170
                             HashMap<String, Object> body = exchange.getIn().getBody(HashMap.class);
170
                             HashMap<String, Object> body = exchange.getIn().getBody(HashMap.class);
171
-                            String format = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
171
+                            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
172
+                            String format = LocalDateTime.now().format(df);
173
+                            String yesterday = LocalDateTime.now().minusDays(1).format(df);
174
+                            body.put("yesterday", yesterday);
172
                             if (body.get("well_common_name") == null || body.get("well_common_name").equals("")) {
175
                             if (body.get("well_common_name") == null || body.get("well_common_name").equals("")) {
173
                                 body.put("remarks","暂无井信息");
176
                                 body.put("remarks","暂无井信息");
174
                                 body.put("error_id",0);
177
                                 body.put("error_id",0);
@@ -182,9 +185,14 @@ public class CamelJDBCConfiguration {
182
                                 body.put("error_id",1);
185
                                 body.put("error_id",1);
183
                                 body.put("updateTime",format);
186
                                 body.put("updateTime",format);
184
                             }
187
                             }
188
+
185
                         })
189
                         })
186
                         //之前在数据导入时没有自动填写入最后更新时间,会导致新加入的数据无法自动导入
190
                         //之前在数据导入时没有自动填写入最后更新时间,会导致新加入的数据无法自动导入
187
-                        .setBody(simple("update centralbase.sys_access_well_control set well_common_name='${body[well_common_name]}',org_id='${body[org_id]}',update_time = '${body[updateTime]}'::timestamp,sgt_last_time='${body[updateTime]}', remarks ='${body[remarks]}' ,error_id ='${body[error_id]}' where well_id ='${body[well_id]}' "))
191
+                        .setBody(simple("update centralbase.sys_access_well_control set well_common_name='${body[well_common_name]}'," +
192
+                                "org_id='${body[org_id]}',update_time = '${body[updateTime]}'::timestamp,sgt_last_time='${body[updateTime]}', " +
193
+                                "remarks ='${body[remarks]}' ,error_id ='${body[error_id]}' " +
194
+                                "where well_id ='${body[well_id]} and " +
195
+                                "(sgt_last_time is null or sgt_last_time<'${body[yesterday]}'::timestamp)"))
188
                         .to("jdbc:centralbase")
196
                         .to("jdbc:centralbase")
189
                         .end();
197
                         .end();
190
 
198
 

+ 1 - 0
src/main/java/com/gct/tools/etlcamelhuge/routeconfig/CamelRocketMQConfiguration.java

@@ -8,4 +8,5 @@ package com.gct.tools.etlcamelhuge.routeconfig;
8
  * @since 2021/5/17 下午4:14
8
  * @since 2021/5/17 下午4:14
9
  */
9
  */
10
 public class CamelRocketMQConfiguration {
10
 public class CamelRocketMQConfiguration {
11
+
11
 }
12
 }

+ 3 - 3
src/main/resources/application.yml

@@ -14,7 +14,7 @@ spring:
14
       type: com.zaxxer.hikari.HikariDataSource
14
       type: com.zaxxer.hikari.HikariDataSource
15
       jdbc-url: jdbc:postgresql://10.72.143.2:54321/database
15
       jdbc-url: jdbc:postgresql://10.72.143.2:54321/database
16
       username: root
16
       username: root
17
-      password: 123456
17
+      password: StarDouble*2121
18
       driver-class-name: org.postgresql.Driver
18
       driver-class-name: org.postgresql.Driver
19
       hikari:
19
       hikari:
20
         ## 连接池名字
20
         ## 连接池名字
@@ -34,7 +34,7 @@ spring:
34
     ds2:
34
     ds2:
35
       ## Hikari连接池的设置 Hikari 时间单位都是毫秒
35
       ## Hikari连接池的设置 Hikari 时间单位都是毫秒
36
       type: com.zaxxer.hikari.HikariDataSource
36
       type: com.zaxxer.hikari.HikariDataSource
37
-      jdbc-url: jdbc:oracle:thin:@11.71.15.28:1521:oracycn2
37
+      jdbc-url: jdbc:oracle:thin:@11.71.15.28:1521/oracycn
38
       username: ZD_FGD
38
       username: ZD_FGD
39
       password: ZJGSDDS#2014ZD
39
       password: ZJGSDDS#2014ZD
40
       driver-class-name: oracle.jdbc.driver.OracleDriver
40
       driver-class-name: oracle.jdbc.driver.OracleDriver
@@ -100,7 +100,7 @@ spring:
100
     ds5:
100
     ds5:
101
       ## Hikari连接池的设置 Hikari 时间单位都是毫秒
101
       ## Hikari连接池的设置 Hikari 时间单位都是毫秒
102
       type: com.zaxxer.hikari.HikariDataSource
102
       type: com.zaxxer.hikari.HikariDataSource
103
-      jdbc-url: jdbc:oracle:thin:@11.71.15.28:1521:oracycn2
103
+      jdbc-url: jdbc:oracle:thin:@11.71.15.28:1521/oracycn
104
       username: ZD_A2USER
104
       username: ZD_A2USER
105
       password: ZDcyc#zjk3832758
105
       password: ZDcyc#zjk3832758
106
       driver-class-name: oracle.jdbc.driver.OracleDriver
106
       driver-class-name: oracle.jdbc.driver.OracleDriver

+ 1 - 11
src/test/java/com/gct/tools/etlcamelhuge/EtlCamelHugeApplicationTests.java

@@ -1,7 +1,5 @@
1
 package com.gct.tools.etlcamelhuge;
1
 package com.gct.tools.etlcamelhuge;
2
 
2
 
3
-import com.gct.tools.etlcamelhuge.MQ.MessageProducer;
4
-import com.gct.tools.etlcamelhuge.entity.DiagnoseMsg;
5
 import com.gct.tools.etlcamelhuge.routeconfig.CamelJDBCConfiguration;
3
 import com.gct.tools.etlcamelhuge.routeconfig.CamelJDBCConfiguration;
6
 import lombok.Data;
4
 import lombok.Data;
7
 import org.junit.jupiter.api.Test;
5
 import org.junit.jupiter.api.Test;
@@ -10,7 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.boot.test.context.SpringBootTest;
8
 import org.springframework.boot.test.context.SpringBootTest;
11
 import org.springframework.test.context.junit4.SpringRunner;
9
 import org.springframework.test.context.junit4.SpringRunner;
12
 
10
 
13
-import javax.annotation.Resource;
14
 import java.lang.reflect.Array;
11
 import java.lang.reflect.Array;
15
 import java.lang.reflect.InvocationTargetException;
12
 import java.lang.reflect.InvocationTargetException;
16
 import java.time.LocalDate;
13
 import java.time.LocalDate;
@@ -20,7 +17,7 @@ import java.util.Arrays;
20
 import java.util.List;
17
 import java.util.List;
21
 
18
 
22
 @RunWith(SpringRunner.class)
19
 @RunWith(SpringRunner.class)
23
-@SpringBootTest(classes = EtlCamelHugeApplication.class)
20
+@SpringBootTest
24
 class EtlCamelHugeApplicationTests {
21
 class EtlCamelHugeApplicationTests {
25
 
22
 
26
    /* @Autowired
23
    /* @Autowired
@@ -162,13 +159,6 @@ class EtlCamelHugeApplicationTests {
162
     public static void main(String args[]) throws Exception {
159
     public static void main(String args[]) throws Exception {
163
         System.out.println(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
160
         System.out.println(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
164
     }
161
     }
165
-    @Resource(name = "diagnoseMessageProducer")
166
-    private MessageProducer producer;
167
 
162
 
168
-    @Test
169
-    public void testProducer(){
170
-        producer.send(new DiagnoseMsg("xx1","asdf","0","2225-12-12 12:12:56"
171
-                ,"123.,2,3,2,31.2.31.23.0","dfasdf",12,12));
172
-    }
173
 
163
 
174
 }
164
 }