fix: 数据类型改配置的读取

scpwxyy
chenhc 7 months ago
parent f6abf07134
commit 78f8dac9fa

@ -34,6 +34,7 @@ import com.glxp.mipsdl.util.ResultVOUtils;
import com.glxp.mipsdl.util.SubmitOrderUtil; import com.glxp.mipsdl.util.SubmitOrderUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -78,6 +79,11 @@ public abstract class CommonHttpClient implements BaseHttpClient {
@Autowired @Autowired
private SubmitOrderUtil submitOrderUtil; private SubmitOrderUtil submitOrderUtil;
@Value("${spring.datasource.typeD}")
private String typeD;
@Override @Override
public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) { public BaseResponse getUnit(UdiwmsUnitRequest udiwmsUnitRequest) {
String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_CORP_URL), udiwmsUnitRequest); String response = httpClient.postJson(thrSystemDetailService.getUrl(Constants.URL_NAME_CORP_URL), udiwmsUnitRequest);
@ -324,27 +330,27 @@ public abstract class CommonHttpClient implements BaseHttpClient {
private DataSource dataSource; private DataSource dataSource;
public String getDataSourceType(){ public String getDataSourceType(){
Connection conn = null; // Connection conn = null;
DatabaseMetaData metaData = null; // DatabaseMetaData metaData = null;
String databaseProductName = ""; // String databaseProductName = "";
try { // try {
conn = dataSource.getConnection(); // conn = dataSource.getConnection();
metaData = conn.getMetaData(); // metaData = conn.getMetaData();
databaseProductName = metaData.getDatabaseProductName();//MySQL //Oracle // databaseProductName = metaData.getDatabaseProductName();//MySQL //Oracle
} catch (SQLException throwables) { // } catch (SQLException throwables) {
throwables.printStackTrace(); // throwables.printStackTrace();
}finally { // }finally {
// 释放连接资源 // // 释放连接资源
if (conn != null) { // if (conn != null) {
try { // try {
conn.close(); // conn.close();
} catch (SQLException e) { // } catch (SQLException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
} // }
return databaseProductName; return typeD;
} }
} }

@ -1,11 +1,12 @@
spring: spring:
datasource: datasource:
typeD: MySQL
dynamic: dynamic:
primary: master primary: master
strict: false strict: false
datasource: datasource:
master: master:
url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:p6spy:mysql://127.0.0.1:3306/udi_wms_ywj?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: root username: root
password: 123456 password: 123456
driver-class-name: com.p6spy.engine.spy.P6SpyDriver driver-class-name: com.p6spy.engine.spy.P6SpyDriver

@ -1,5 +1,6 @@
spring: spring:
datasource: datasource:
typeD: Oracle
dynamic: dynamic:
primary: master primary: master
strict: false strict: false

Loading…
Cancel
Save