Bladeren bron

[task-1530] 【后端】中大七院冰箱温控数据对接

Li Yuan 2 jaren geleden
bovenliggende
commit
6aebeba981

+ 2 - 1
exchange/application.properties → exchange/application.properties_backup

@@ -5,4 +5,5 @@ spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
 spring.second-datasource.jdbc-url = jdbc:mysql://10.1.6.245:3306/klims-ibps3?characterEncoding=utf8&useSSL=false
 spring.second-datasource.username = root
 spring.second-datasource.password = Zdqy123456
-spring.second-datasource.driver-class-name = com.mysql.cj.jdbc.Driver
+spring.second-datasource.driver-class-name = com.mysql.cj.jdbc.Driver
+fetch.sql=select * from jyk1.v_get_ref_temperature  where TO_CHAR(\u91c7\u96c6\u65f6\u95f4,'YYYY-MM-DD')=TO_CHAR(SYSDATE,'YYYY-MM-DD')

+ 10 - 2
exchange/src/main/java/com/jyxt/thridparty/exchange/bx/repository/VendorBinxiangRepository.java

@@ -1,7 +1,11 @@
 package com.jyxt.thridparty.exchange.bx.repository;
 
+import com.jyxt.thridparty.exchange.ExchangeApplication;
 import com.jyxt.thridparty.exchange.bx.VendorBinxiang;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.RowMapper;
 import org.springframework.stereotype.Repository;
@@ -11,13 +15,17 @@ import java.sql.SQLException;
 import java.util.List;
 @Repository
 public class VendorBinxiangRepository {
-
+    private static final Logger log = LoggerFactory.getLogger(VendorBinxiangRepository.class);
     @Autowired
     private JdbcTemplate jdbcTemplate;
 
+    @Value("${fetch.sql}")
+    private String sql;
+
     public List<VendorBinxiang> query() {
+        log.info(sql);
         return jdbcTemplate.query(
-                "select * from jyk1.v_get_ref_temperature  where TO_CHAR(采集时间,'YYYY-MM-DD')=TO_CHAR(SYSDATE,'YYYY-MM-DD')",new RowMapper<VendorBinxiang>(){
+                sql,new RowMapper<VendorBinxiang>(){
 
                     @Override
                     public VendorBinxiang mapRow(ResultSet rs, int rowNum) throws SQLException {

+ 2 - 1
exchange/src/main/resources/application.properties

@@ -5,4 +5,5 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 spring.second-datasource.jdbc-url = jdbc:mysql://dev1.local:3306/klims-ibps3?characterEncoding=utf8&useSSL=false
 spring.second-datasource.username = root
 spring.second-datasource.password = test001
-spring.second-datasource.driver-class-name = com.mysql.cj.jdbc.Driver
+spring.second-datasource.driver-class-name = com.mysql.cj.jdbc.Driver
+fetch.sql=select * from v_get_ref_temperature  where date(\u91c7\u96c6\u65f6\u95f4)=curdate()