fix(测试接口)
parent
27d2c0cf61
commit
1725f52624
|
@ -52,6 +52,11 @@
|
||||||
<artifactId>muyu-common-security</artifactId>
|
<artifactId>muyu-common-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Zipkin 客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -28,5 +28,10 @@
|
||||||
<artifactId>muyu-data-source-common</artifactId>
|
<artifactId>muyu-data-source-common</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Zipkin 客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
<artifactId>spring-context-support</artifactId>
|
<artifactId>spring-context-support</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Spring Web -->
|
<!-- Spring Web -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
|
@ -136,6 +138,11 @@
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Zipkin 客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -24,5 +24,10 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>muyu-common-core</artifactId>
|
<artifactId>muyu-common-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Zipkin 客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -23,5 +23,10 @@
|
||||||
<artifactId>muyu-common-security</artifactId>
|
<artifactId>muyu-common-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Zipkin 客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -31,5 +31,10 @@
|
||||||
<version>${dynamic-ds.version}</version>
|
<version>${dynamic-ds.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Zipkin 客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -88,6 +88,11 @@
|
||||||
<version>${swagger.fox.version}</version>
|
<version>${swagger.fox.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Zipkin 客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -51,5 +51,10 @@
|
||||||
<artifactId>muyu-common-method</artifactId>
|
<artifactId>muyu-common-method</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Zipkin 客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package com.muyu.source.clinet.connection.service;
|
package com.muyu.source.clinet.connection.service;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
import com.alibaba.druid.pool.DruidPooledConnection;
|
import com.alibaba.druid.pool.DruidPooledConnection;
|
||||||
import com.muyu.data.source.domain.DataSource;
|
import com.muyu.data.source.domain.DataSource;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.muyu.source.clinet.connection.pool.ConnectionPoolContext.*;
|
import static com.muyu.source.clinet.connection.pool.ConnectionPoolContext.*;
|
||||||
|
@ -16,6 +19,7 @@ import static com.muyu.source.clinet.connection.pool.ConnectionPoolContext.*;
|
||||||
* @Date 2024/5/16 19:39
|
* @Date 2024/5/16 19:39
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
@Component
|
@Component
|
||||||
public class ConnectionPoolManagementService {
|
public class ConnectionPoolManagementService {
|
||||||
|
|
||||||
|
@ -31,18 +35,22 @@ public class ConnectionPoolManagementService {
|
||||||
*/
|
*/
|
||||||
public void createPool(DataSource dataSource){
|
public void createPool(DataSource dataSource){
|
||||||
|
|
||||||
}
|
/**eq* 获取
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取
|
|
||||||
* @param dataSource
|
* @param dataSource
|
||||||
*/
|
*/
|
||||||
|
}
|
||||||
public DruidPooledConnection get(DataSource dataSource){
|
public DruidPooledConnection get(DataSource dataSource){
|
||||||
return getConnection(dataSource.getAccessSourceName());
|
return get(dataSource.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public DruidPooledConnection get(String key){
|
public DruidPooledConnection get(String key){
|
||||||
|
DruidDataSource druidDataSource = getConnection(key);
|
||||||
|
try {
|
||||||
|
return druidDataSource.getConnection();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.warn("获取连接异常:[{}] - [{}]",key,e.getMessage(),e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,7 +58,12 @@ public class ConnectionPoolManagementService {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void returnConnection(DruidPooledConnection connection){
|
public void returnConnection(DruidPooledConnection connection){
|
||||||
|
try {
|
||||||
|
connection.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.warn("获取连接异常:[{}] - [{}]",e.getMessage(),e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -106,6 +106,10 @@ public class DataSource extends BaseEntity {
|
||||||
@ApiModelProperty(name = "数据库用户密码", value = "数据库用户密码")
|
@ApiModelProperty(name = "数据库用户密码", value = "数据库用户密码")
|
||||||
private String databaseUserPassword;
|
private String databaseUserPassword;
|
||||||
|
|
||||||
|
public String getKey(){
|
||||||
|
return id + accessSourceName + dataSourceSystemName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询构造器
|
* 查询构造器
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -88,7 +88,11 @@
|
||||||
<version>1.2.20</version>
|
<version>1.2.20</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- Zipkin 客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,6 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
||||||
@Override
|
@Override
|
||||||
public Result synchronization(DataSource dataSource) {
|
public Result synchronization(DataSource dataSource) {
|
||||||
AssetStructure assetStructure = new AssetStructure();
|
AssetStructure assetStructure = new AssetStructure();
|
||||||
|
|
||||||
String user=dataSource.getDatabaseUserName();
|
String user=dataSource.getDatabaseUserName();
|
||||||
String password=dataSource.getDatabaseUserPassword();
|
String password=dataSource.getDatabaseUserPassword();
|
||||||
String jdbcDriver="com.mysql.cj.jdbc.Driver";
|
String jdbcDriver="com.mysql.cj.jdbc.Driver";
|
||||||
|
|
|
@ -148,4 +148,6 @@ public class EngineMaintenanceController extends BaseController
|
||||||
public Result<String> statusOnOff(@RequestBody Ruleengine ruleengine){
|
public Result<String> statusOnOff(@RequestBody Ruleengine ruleengine){
|
||||||
return engineMaintenanceService.statusOnOff(ruleengine);
|
return engineMaintenanceService.statusOnOff(ruleengine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,15 +103,13 @@ public class EngineMaintenanceServiceImpl extends ServiceImpl<EngineMaintenanceM
|
||||||
boolean success = task.call();
|
boolean success = task.call();
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
return Result.success("编译成功");
|
return null;
|
||||||
} else {
|
|
||||||
return Result.error("编译失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Result.error(e.getMessage());
|
Result.error(e.getMessage());
|
||||||
}
|
}
|
||||||
return Result.error("编译失败");
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue