package com.zd.system.api.chemical.factory;

import com.zd.common.core.domain.R;
import com.zd.system.api.chemical.RemoteChemicalService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 考试服务降级处理
 *
 * @author zhoupan
 */
@Component
public class RemoteChemicalFallbackFactory implements FallbackFactory<RemoteChemicalService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteChemicalFallbackFactory.class);

    @Override
    public RemoteChemicalService create(Throwable throwable) {
        log.error("化学品管理调用失败:{}", throwable.getMessage());
        return new RemoteChemicalService() {
            @Override
            public R<Boolean> updateStatus(String ipAddress, Integer terminalStatus) {
                return R.fail("化学品管理调用失败:" + throwable.getMessage());
            }

            @Override
            public R<List<Map<String, Object>>> queryCriticaliBySubId(List<Long> subIds) {

                return R.fail("查询实验室化学品临界量风险指标失败:" + throwable.getMessage());
            }
        };
    }
}
