New file |
| | |
| | | package com.ruoyi.integration.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.feignClient.SecurityDetectionClient; |
| | | import com.ruoyi.integration.api.feignClient.SendMessageClient; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class SecurityDetectionFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<SecurityDetectionClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(SecurityDetectionFallbackFactory.class); |
| | | |
| | | @Override |
| | | public SecurityDetectionClient create(Throwable throwable) { |
| | | log.error("调用失败:{}", throwable.getMessage()); |
| | | return new SecurityDetectionClient() { |
| | | |
| | | @Override |
| | | public R<SecurityDetection> getSecurityDetection(String transactionSerialNumber) { |
| | | return R.fail("获取安全检测数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |