package com.sptg.estate.api.feigns.fallback;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.ExcelResultEnum;
import com.sptg.common.core.beans.PageBean;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.estate.api.dto.SimpleUserDto;
import com.sptg.estate.api.dto.ThirdUserDto;
import com.sptg.estate.api.dto.UserDto;
import com.sptg.estate.api.entity.ThirdUser;
import com.sptg.estate.api.entity.User;
import com.sptg.estate.api.feigns.ThirdUserFeign;
import com.sptg.estate.api.feigns.UserFeign;
import com.sptg.estate.api.vo.DevicesAccessPushVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * title: UserFeignFallbackFactory
 * package: com.sptg.estate.api.feigns.fallback
 * description: 住户 服务接口容错处理
 *
 *
 *
 */
@Component
@Slf4j
public class ThirdUserFeignFallbackFactory implements FallbackFactory<ThirdUserFeign> {

    @Override
    public ThirdUserFeign create(Throwable cause) {
        return new ThirdUserFeign() {

            @Override
            public ResultBean<Boolean> addUser(ThirdUserDto userDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public ThirdUser findUserById(Long id) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public ResultBean<Boolean> updateUser(ThirdUserDto userDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public ResultBean<Boolean> deleteUser(ThirdUserDto userDto) {
                log.error(cause.getMessage(),cause);
                return null;
            }

            @Override
            public boolean updateEntity(ThirdUser user) {
                log.error(cause.getMessage(),cause);
                return false;
            }

            @Override
            public List<ThirdUser> getListByCondition(ThirdUserDto dto) {
                log.error(cause.getMessage(),cause);
                return null;
            }
        };
    }
}
