feat:修复已知问题,提升系统稳定性
This commit is contained in:
@@ -7,34 +7,20 @@
|
||||
<description>remi-demo-api</description>
|
||||
|
||||
<parent>
|
||||
<groupId>ai.remi.top.cloud</groupId>
|
||||
<groupId>ai.remi.top.demo</groupId>
|
||||
<artifactId>remi-demo</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.1.0</version>
|
||||
</parent>
|
||||
|
||||
<!-- 打包上传到私服, 需要和配置文件中的server节点配合使用 -->
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven-releases</id>
|
||||
<name>release</name>
|
||||
<url>https://repository.njydsz.com/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>maven-snapshots</id>
|
||||
<name>snapshot</name>
|
||||
<url>https://repository.njydsz.com/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<!--remi-comm-feign-->
|
||||
<dependency>
|
||||
<groupId>ai.remi.top.cloud</groupId>
|
||||
<groupId>ai.remi.top.comm</groupId>
|
||||
<artifactId>remi-comm-feign</artifactId>
|
||||
</dependency>
|
||||
<!--remi-demo-domain-->
|
||||
<dependency>
|
||||
<groupId>ai.remi.top.cloud</groupId>
|
||||
<groupId>ai.remi.top.demo</groupId>
|
||||
<artifactId>remi-demo-domain</artifactId>
|
||||
</dependency>
|
||||
<!--servlet-api-->
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package ai.remi.boot.api.client;
|
||||
|
||||
import ai.remi.comm.core.result.ResultBean;
|
||||
import ai.remi.comm.feign.aspect.FeignAutoConfiguration;
|
||||
import ai.remi.boot.api.factory.IamClientFactory;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(value = "remi-boot-web", configuration = FeignAutoConfiguration.class, fallbackFactory = IamClientFactory.class)
|
||||
public interface IamClientApi {
|
||||
|
||||
@Operation(summary = "保存日志")
|
||||
@PostMapping("/logRecord/add")
|
||||
ResultBean<Boolean> addLogRecord(@RequestBody @Validated LogRecordPostDTO logRecordDTO);
|
||||
|
||||
@Operation(summary = "查询用户全局配置")
|
||||
@PostMapping(value = "/config/getUserConfigs")
|
||||
ResultBean<List<ConfigVO>> getUserConfigs();
|
||||
|
||||
@Operation(summary = "查询应用全局配置")
|
||||
@PostMapping(value = "/config/getAppConfigs")
|
||||
ResultBean<List<ConfigVO>> getAppConfigs(@RequestParam("appId") String appId, @RequestParam("confType") Integer confType);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package ai.remi.boot.api.factory;
|
||||
|
||||
import ai.remi.boot.api.client.IamClientApi;
|
||||
import ai.remi.boot.api.fallback.IamClientFallback;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class IamClientFactory implements FallbackFactory<IamClientApi> {
|
||||
|
||||
@Override
|
||||
public IamClientApi create(Throwable cause) {
|
||||
IamClientFallback fallback = new IamClientFallback();
|
||||
fallback.setCause(cause);
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package ai.remi.boot.api.fallback;
|
||||
|
||||
import ai.remi.comm.core.result.ResultBean;
|
||||
import ai.remi.boot.api.client.IamClientApi;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
public class IamClientFallback implements IamClientApi {
|
||||
@Setter
|
||||
private Throwable cause;
|
||||
|
||||
@Override
|
||||
public ResultBean<Boolean> addLogRecord(LogRecordPostDTO logRecordDTO) {
|
||||
log.error("addLogRecord = {}", cause.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean<List<ConfigVO>> getUserConfigs() {
|
||||
log.error("getUserConfigs = {}", cause.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean<List<ConfigVO>> getAppConfigs(String appId, Integer confType) {
|
||||
log.error("getAppConfigs = {}", cause.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package ai.remi.demo.api.client;
|
||||
|
||||
import ai.remi.demo.api.factory.FeignClientFactory;
|
||||
import ai.remi.comm.feign.aspect.FeignAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(value = "remi-demo-web", configuration = FeignAutoConfiguration.class, fallbackFactory = FeignClientFactory.class)
|
||||
public interface FeignClientApi {
|
||||
|
||||
@GetMapping("/books/findByBooksId")
|
||||
String findById(@RequestParam("booksId") int booksId);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package ai.remi.demo.api.factory;
|
||||
|
||||
import ai.remi.demo.api.client.FeignClientApi;
|
||||
import ai.remi.demo.api.fallback.FeignClientFallback;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class FeignClientFactory implements FallbackFactory<FeignClientApi> {
|
||||
|
||||
@Override
|
||||
public FeignClientApi create(Throwable cause) {
|
||||
FeignClientFallback fallback = new FeignClientFallback();
|
||||
fallback.setCause(cause);
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package ai.remi.demo.api.fallback;
|
||||
|
||||
import ai.remi.demo.api.client.FeignClientApi;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class FeignClientFallback implements FeignClientApi {
|
||||
@Setter
|
||||
private Throwable cause;
|
||||
|
||||
@Override
|
||||
public String findById(int goodsId) {
|
||||
log.error("findById = {}", cause.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user