feat:修复已知问题,提升系统稳定性
This commit is contained in:
53
remi-sys/remi-sys-api/pom.xml
Normal file
53
remi-sys/remi-sys-api/pom.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>remi-sys-api</artifactId>
|
||||
<name>remi-sys-api</name>
|
||||
<description>remi-sys-api</description>
|
||||
|
||||
<parent>
|
||||
<groupId>ai.remi.cloud</groupId>
|
||||
<artifactId>remi-sys</artifactId>
|
||||
<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.comm</groupId>
|
||||
<artifactId>remi-comm-feign</artifactId>
|
||||
</dependency>
|
||||
<!--remi-sys-domain-->
|
||||
<dependency>
|
||||
<groupId>ai.remi.cloud</groupId>
|
||||
<artifactId>remi-sys-domain</artifactId>
|
||||
</dependency>
|
||||
<!--servlet-api-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
<!--lombok-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,31 @@
|
||||
package ai.remi.sys.api.client;
|
||||
|
||||
import ai.remi.comm.core.result.ResultBean;
|
||||
import ai.remi.comm.feign.aspect.FeignAutoConfiguration;
|
||||
import ai.remi.sys.api.factory.IamClientFactory;
|
||||
import ai.remi.sys.domain.dto.post.LogRecordPostDTO;
|
||||
import ai.remi.sys.domain.vo.ConfigVO;
|
||||
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-sys-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.sys.api.factory;
|
||||
|
||||
import ai.remi.sys.api.client.IamClientApi;
|
||||
import ai.remi.sys.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,35 @@
|
||||
package ai.remi.sys.api.fallback;
|
||||
|
||||
import ai.remi.comm.core.result.ResultBean;
|
||||
import ai.remi.sys.api.client.IamClientApi;
|
||||
import ai.remi.sys.domain.dto.post.LogRecordPostDTO;
|
||||
import ai.remi.sys.domain.vo.ConfigVO;
|
||||
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