DeviceLocationFallbackImpl.java 1.13 KB
package cn.com.glsx.stdinterface.fallback;

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

import java.util.Collection;
import java.util.List;

/**
 * 设备上点服务异常处理实现类
 *
 * @author yll
 */
@Slf4j
@Component
public class DeviceLocationFallbackImpl implements DeviceLocationClient {

    @Setter
    private Throwable cause;

    @Override
    public R<Integer> dropLibrary(Collection<DeviceLocationDto> deviceLocationDtos) {
        log.warn("dropLibrary===设备位置数据落库熔断啦 {}", cause.getMessage());
        return R.ok("服务异常");
    }

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

    @Override
    public R<List<DeviceLocationDto>> getAllDeviceLocationData() {
        log.warn("getAllDeviceLocationData===熔断啦 {}", cause.getMessage());
        return R.ok("服务异常");
    }
}