Browse Source

zd bug fix

xsr 3 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 168
                         .split(body())
169 169
                         .split(body()).process(exchange -> {
170 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 175
                             if (body.get("well_common_name") == null || body.get("well_common_name").equals("")) {
173 176
                                 body.put("remarks","暂无井信息");
174 177
                                 body.put("error_id",0);
@@ -182,9 +185,14 @@ public class CamelJDBCConfiguration {
182 185
                                 body.put("error_id",1);
183 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 196
                         .to("jdbc:centralbase")
189 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 8
  * @since 2021/5/17 下午4:14
9 9
  */
10 10
 public class CamelRocketMQConfiguration {
11
+
11 12
 }

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

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

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

@@ -1,7 +1,5 @@
1 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 3
 import com.gct.tools.etlcamelhuge.routeconfig.CamelJDBCConfiguration;
6 4
 import lombok.Data;
7 5
 import org.junit.jupiter.api.Test;
@@ -10,7 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired;
10 8
 import org.springframework.boot.test.context.SpringBootTest;
11 9
 import org.springframework.test.context.junit4.SpringRunner;
12 10
 
13
-import javax.annotation.Resource;
14 11
 import java.lang.reflect.Array;
15 12
 import java.lang.reflect.InvocationTargetException;
16 13
 import java.time.LocalDate;
@@ -20,7 +17,7 @@ import java.util.Arrays;
20 17
 import java.util.List;
21 18
 
22 19
 @RunWith(SpringRunner.class)
23
-@SpringBootTest(classes = EtlCamelHugeApplication.class)
20
+@SpringBootTest
24 21
 class EtlCamelHugeApplicationTests {
25 22
 
26 23
    /* @Autowired
@@ -162,13 +159,6 @@ class EtlCamelHugeApplicationTests {
162 159
     public static void main(String args[]) throws Exception {
163 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
 }