package com.yida.data.user.fallback;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.user.EduUserDeviceFactory;
import com.yida.data.user.feign.RemoteUserDeviceFactoryService;
import com.yida.data.user.vo.UserDeviceInfoVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * RemoteUserDeviceFactoryService fallback处理类
 *
 * @author ZYJ
 * @date 2022/8/26
 */
@Slf4j
@Fallback
public class RemoteUserDeviceFactoryServiceFallback implements FallbackFactory<RemoteUserDeviceFactoryService> {

    @Override
    public RemoteUserDeviceFactoryService create(Throwable throwable) {
        log.error("RemoteUserDeviceFactoryService fallback reason:{}", throwable.getMessage());

        return new RemoteUserDeviceFactoryService() {
            @Override
            public ResultBean batchSaveUserDeviceFactory(List<EduUserDeviceFactory> userDeviceFactoryList) {
                return null;
            }

            /**
             * 通过考勤设备方学生的唯一标识查询系统内用户信息
             *
             * @param flag
             * @param type
             */
            @Override
            public ResultBean<UserDeviceInfoVO> getUserInfoByDevciceFactory(String flag, String type) {
                return null;
            }
        };
    }
}
