package com.bonus.common.biz.service.factory;

import com.bonus.common.biz.domain.BmStorageLog;
import com.bonus.common.core.domain.R;
import com.bonus.common.biz.service.RemoteStoreLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * 物资库存日志服务降级处理
 * 
 * @author syruan
 */
@Component
public class RemoteStoreLogFallbackFactory implements FallbackFactory<RemoteStoreLogService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteStoreLogFallbackFactory.class);

    @Override
    public RemoteStoreLogService create(Throwable throwable)
    {
        log.error("日志服务调用失败:{}", throwable.getMessage());
        return (bmStorageLogList, source) -> R.fail("保存物资库存日志失败:" + throwable.getMessage());
    }
}
