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

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.estate.api.entity.ProjectBook;
import com.sptg.estate.api.feigns.ProjectBookFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * title: ProjectFeignFallbackFactory
 * package: com.sptg.estate.biz.security
 * description: 立项书-服务容错处理类
 *
 *               
 *                     
 */
@Component
@Slf4j
public class ProjectBookFeignFallbackFactory implements FallbackFactory<ProjectBookFeign> {
    @Override
    public ProjectBookFeign create(Throwable cause) {
        return new ProjectBookFeign() {

            @Override
            public ResultBean<Boolean> insertByResidentialId(ProjectBook projectBook) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<ProjectBook> findByProjectId(Long projectId) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Boolean> editByProjectId(ProjectBook projectBook) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }
        };
    }
}
