新增数据接入模块远程调用与熔断,修改任务控制层请求路径

master
面包骑士 2024-09-04 09:07:08 +08:00
parent 42a47e197e
commit a4028b4b36
5 changed files with 59 additions and 39 deletions

View File

@ -22,5 +22,10 @@
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>
<artifactId>cloud-common-core</artifactId> <artifactId>cloud-common-core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-quest-remote</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -20,7 +20,8 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.muyu</groupId> <groupId>com.muyu</groupId>
<artifactId>muyu-quest-common</artifactId> <artifactId>muyu-source-server</artifactId>
<version>3.6.5</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -1,18 +1,26 @@
//package com.muyu.source.remote; package com.muyu.quest.remote;
//
//import com.muyu.source.remote.factory.RemoteDataSourceFactory; import com.muyu.common.core.domain.Result;
//import org.springframework.cloud.openfeign.FeignClient; import com.muyu.quest.remote.factory.RemoteDataSourceFactory;
//import com.muyu.common.core.constant.ServiceNameConstants; import org.springframework.cloud.openfeign.FeignClient;
// import com.muyu.common.core.constant.ServiceNameConstants;
///** import org.springframework.web.bind.annotation.PostMapping;
// * @ ToolIntelliJ IDEA import org.springframework.web.bind.annotation.RequestParam;
// * @ AuthorCHX
// * @ Date2024-08-21-10:50 /**
// * @ Version1.0 * @ ToolIntelliJ IDEA
// * @ Description数据源远程调用 * @ AuthorCHX
// * @author Lenovo * @ Date2024-08-21-10:50
// */ * @ Version1.0
//@FeignClient(contextId = "RemoteDataSourceService",value = ServiceNameConstants.SOURCE_SERVICE,fallbackFactory = RemoteDataSourceFactory.class, path = "/dataSource") * @ Description
//public interface RemoteDataSourceService { * @author Lenovo
// */
//} @FeignClient(contextId = "RemoteDataSourceService",
value = ServiceNameConstants.SOURCE_SERVICE,
fallbackFactory = RemoteDataSourceFactory.class,
path = "/source")
public interface RemoteDataSourceService {
@PostMapping("/value/findTableValue")
public Result findTableValue(@RequestParam("basicId") Long basicId, @RequestParam("sql") String sql);
}

View File

@ -1,19 +1,25 @@
//package com.muyu.source.remote.factory; package com.muyu.quest.remote.factory;
//
//import com.muyu.source.remote.RemoteDataSourceService; import com.muyu.common.core.domain.Result;
//import org.springframework.cloud.openfeign.FallbackFactory; import com.muyu.quest.remote.RemoteDataSourceService;
// import org.springframework.cloud.openfeign.FallbackFactory;
///**
// * @ ToolIntelliJ IDEA /**
// * @ AuthorCHX * @ ToolIntelliJ IDEA
// * @ Date2024-08-21-10:54 * @ AuthorCHX
// * @ Version1.0 * @ Date2024-08-21-10:54
// * @ Description * @ Version1.0
// * @author Lenovo * @ Description
// */ * @author Lenovo
//public class RemoteDataSourceFactory implements FallbackFactory<RemoteDataSourceService> { */
// @Override public class RemoteDataSourceFactory implements FallbackFactory<RemoteDataSourceService> {
// public RemoteDataSourceService create(Throwable cause) { @Override
// return null; public RemoteDataSourceService create(Throwable cause) {
// } return new RemoteDataSourceService() {
//} @Override
public Result findTableValue(Long basicId, String sql) {
return Result.error("数据接入模块连接失败,网络异常...");
}
};
}
}

View File

@ -33,7 +33,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
* @date 2024-08-22 * @date 2024-08-22
*/ */
@RestController @RestController
@RequestMapping("/quest") @RequestMapping("/task")
public class TaskController extends BaseController public class TaskController extends BaseController
{ {
@Resource @Resource