开放添加报警记录接口调用
parent
fc291b12f0
commit
b51d8fad5d
|
@ -23,7 +23,8 @@ public class ServiceNameConstants
|
|||
public static final String FILE_SERVICE = "muyu-file";
|
||||
|
||||
/**
|
||||
* 文件服务的serviceid
|
||||
* 业务服务的serviceid
|
||||
*/
|
||||
public static final String BUSINESS_SERVICE = "muyu-business";
|
||||
|
||||
}
|
||||
|
|
|
@ -11,11 +11,6 @@
|
|||
|
||||
<artifactId>muyu-business-remote</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>20</maven.compiler.source>
|
||||
<maven.compiler.target>20</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.muyu.business.remote;
|
||||
|
||||
import com.muyu.business.domain.req.*;
|
||||
import com.muyu.business.remote.factory.*;
|
||||
import com.muyu.common.core.constant.*;
|
||||
import com.muyu.common.core.domain.*;
|
||||
import org.springframework.cloud.openfeign.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 报警日志服务
|
||||
*
|
||||
* @Author LiYonJie
|
||||
* @Date 2024/4/6
|
||||
*/
|
||||
@FeignClient(contextId = "remoteAlarmLogsService", value = ServiceNameConstants.BUSINESS_SERVICE, fallbackFactory = RemoteAlarmLogsFallbackFactory.class)
|
||||
public interface RemoteAlarmLogsService {
|
||||
/**
|
||||
* 新增报警日志
|
||||
*/
|
||||
@PostMapping
|
||||
public Result add(@RequestBody AlarmLogsAddReq alarmLogsAddReq, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.business.remote.factory;
|
||||
|
||||
import com.muyu.business.domain.req.*;
|
||||
import com.muyu.business.remote.*;
|
||||
import com.muyu.common.core.domain.*;
|
||||
import org.slf4j.*;
|
||||
import org.springframework.cloud.openfeign.*;
|
||||
import org.springframework.stereotype.*;
|
||||
|
||||
/**
|
||||
* 报警日志服务降级处理
|
||||
*
|
||||
* @Author LiYonJie
|
||||
* @Date 2024/4/6
|
||||
*/
|
||||
@Component
|
||||
public class RemoteAlarmLogsFallbackFactory implements FallbackFactory<RemoteAlarmLogsService> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteAlarmLogsFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteAlarmLogsService create(Throwable throwable) {
|
||||
log.error("报警日志调用失败:【{}】", throwable.getMessage());
|
||||
return new RemoteAlarmLogsService() {
|
||||
@Override
|
||||
public Result add(AlarmLogsAddReq alarmLogsAddReq, String source) {
|
||||
return Result.error("报存报警日志失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.business.remote.factory.RemoteAlarmLogsFallbackFactory
|
Loading…
Reference in New Issue