|
@@ -6,7 +6,9 @@ import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.domain.entity.DataSource;
|
|
|
import com.ruoyi.system.service.IDataSourceService;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Map;
|
|
@@ -18,6 +20,24 @@ public class DataSourceController extends BaseController {
|
|
|
@Resource
|
|
|
private IDataSourceService dataSourceService;
|
|
|
|
|
|
+ RestTemplate restTemplate = new RestTemplate();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 数据引擎切换数据源接口地址
|
|
|
+ */
|
|
|
+ @Value("${parameter.ip.DATA_ENGINE_IP}")
|
|
|
+ public String DATA_ENGINE_IP;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 动态表单切换数据源接口地址
|
|
|
+ */
|
|
|
+ @Value("${parameter.ip.DRAG_FORM_IP}")
|
|
|
+ public String DRAG_FORM_IP;
|
|
|
+
|
|
|
+ @Value("${parameter.ip.PROCESS_ENGINE_IP}")
|
|
|
+ public String PROCESS_ENGINE_IP;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 数据源信息列表
|
|
|
*/
|
|
@@ -41,4 +61,18 @@ public class DataSourceController extends BaseController {
|
|
|
return dataSourceService.insertDataSource(dataSource,tenantId.longValue());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 调用(数据引擎、流程引擎、表单引擎)切换数据源接口
|
|
|
+ */
|
|
|
+ @PostMapping("/changeDatasource")
|
|
|
+ public AjaxResult changeDatasource(@RequestBody DataSource dataSource){
|
|
|
+ //调用数据引擎服务切换数据源接口
|
|
|
+// restTemplate.postForEntity(DATA_ENGINE_IP, dataSource, DataSource.class);
|
|
|
+// //调用表单引擎服务切换数据源接口
|
|
|
+// restTemplate.postForEntity(DRAG_FORM_IP, dataSource, DataSource.class);
|
|
|
+ //调用流程引擎服务切换数据源接口
|
|
|
+ restTemplate.postForEntity(PROCESS_ENGINE_IP, dataSource, DataSource.class);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
}
|