feat:修复已知问题,提升系统稳定性
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user