BatteryFallbackImpl.java 840 Bytes
package cn.com.glsx.stdinterface.fallback;

import cn.com.glsx.stdinterface.api.BatteryClient;
import cn.com.glsx.stdinterface.dto.DevicePowerDTO;
import com.glsx.plat.core.web.R;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author xiangyanlin
 * @date 2022/4/12
 */
@Slf4j
@Component
public class BatteryFallbackImpl implements BatteryClient {

    @Setter
    private Throwable cause;

    @Override
    public R saveBatteryInfo(DevicePowerDTO devicePowerDTO) {
        log.warn("saveBatteryInfo 熔断啦 {}", cause.getMessage());
        return R.ok("服务异常");
    }

    @Override
    public R<DevicePowerDTO> getDevicePowerBySn(String sn) {
        log.warn("getDevicePowerBySn 熔断啦 {}", cause.getMessage());
        return R.ok("服务异常");
    }
}