fix(测试接口)

master
031026 2024-05-16 22:28:22 +08:00
parent 27d2c0cf61
commit 1725f52624
14 changed files with 76 additions and 14 deletions

View File

@ -52,6 +52,11 @@
<artifactId>muyu-common-security</artifactId>
</dependency>
<!-- Zipkin 客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -28,5 +28,10 @@
<artifactId>muyu-data-source-common</artifactId>
<version>3.6.3</version>
</dependency>
<!-- Zipkin 客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -35,6 +35,8 @@
<artifactId>spring-context-support</artifactId>
</dependency>
<!-- Spring Web -->
<dependency>
<groupId>org.springframework</groupId>
@ -136,6 +138,11 @@
<artifactId>lombok</artifactId>
</dependency>
<!-- Zipkin 客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -24,5 +24,10 @@
<groupId>com.muyu</groupId>
<artifactId>muyu-common-core</artifactId>
</dependency>
<!-- Zipkin 客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -23,5 +23,10 @@
<artifactId>muyu-common-security</artifactId>
</dependency>
<!-- Zipkin 客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -31,5 +31,10 @@
<version>${dynamic-ds.version}</version>
</dependency>
<!-- Zipkin 客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -88,6 +88,11 @@
<version>${swagger.fox.version}</version>
</dependency>
<!-- Zipkin 客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -51,5 +51,10 @@
<artifactId>muyu-common-method</artifactId>
<version>3.6.3</version>
</dependency>
<!-- Zipkin 客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,9 +1,12 @@
package com.muyu.source.clinet.connection.service;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidPooledConnection;
import com.muyu.data.source.domain.DataSource;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;
import java.sql.SQLException;
import java.util.List;
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
*/
@Log4j2
@Component
public class ConnectionPoolManagementService {
@ -31,18 +35,22 @@ public class ConnectionPoolManagementService {
*/
public void createPool(DataSource dataSource){
/**eq*
* @param dataSource
*/
}
/**
*
* @param dataSource
*/
public DruidPooledConnection get(DataSource dataSource){
return getConnection(dataSource.getAccessSourceName());
return get(dataSource.getKey());
}
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){
try {
connection.close();
} catch (SQLException e) {
log.warn("获取连接异常:[{}] - [{}]",e.getMessage(),e);
throw new RuntimeException(e);
}
}
/**

View File

@ -106,6 +106,10 @@ public class DataSource extends BaseEntity {
@ApiModelProperty(name = "数据库用户密码", value = "数据库用户密码")
private String databaseUserPassword;
public String getKey(){
return id + accessSourceName + dataSourceSystemName;
}
/**
*
*/

View File

@ -88,7 +88,11 @@
<version>1.2.20</version>
<scope>compile</scope>
</dependency>
<!-- Zipkin 客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
</dependency>
</dependencies>

View File

@ -237,7 +237,6 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
@Override
public Result synchronization(DataSource dataSource) {
AssetStructure assetStructure = new AssetStructure();
String user=dataSource.getDatabaseUserName();
String password=dataSource.getDatabaseUserPassword();
String jdbcDriver="com.mysql.cj.jdbc.Driver";

View File

@ -148,4 +148,6 @@ public class EngineMaintenanceController extends BaseController
public Result<String> statusOnOff(@RequestBody Ruleengine ruleengine){
return engineMaintenanceService.statusOnOff(ruleengine);
}
}

View File

@ -103,15 +103,13 @@ public class EngineMaintenanceServiceImpl extends ServiceImpl<EngineMaintenanceM
boolean success = task.call();
if (success) {
return Result.success("编译成功");
} else {
return Result.error("编译失败");
return null;
}
} catch (Exception e) {
Result.error(e.getMessage());
}
return Result.error("编译失败");
return null;
}
@Override