package com.pj.api.client.async_server;

import com.pj.api.client.cfg.SpCfgInterfaceFallback;
import com.pj.api.dto.ImportDeclarePeopleDto;
import com.pj.api.dto.OrderDto;
import com.pj.api.dto.OrdersDto;
import com.pj.api.dto.PeopleConfirmDTO;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @Author Mechrevo
 * @Date 2023 08 29 13 03
 **/
@Component
public class AsyncServerInterfaceFallback implements FallbackFactory<AsyncServerInterface> {

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

    @Override
    public AsyncServerInterface create(Throwable throwable) {
        return new AsyncServerInterface() {

            @Override
            public  void sendLevelOneOrderDto(OrderDto t, String dataType) {
                log.error("错误对象:{},类型:{}",t,dataType);
            }

            @Override
            public void sendLevelTwoOrdersDto(OrdersDto t, String dataType) {
                log.error("错误对象:{},类型:{}",t,dataType);
            }

            @Override
            public void sendConfirm(PeopleConfirmDTO confirmDTO) {

            }

            @Override
            public ImportDeclarePeopleDto getByIdNoAndPreleportNo(String idNo, String preleportNo) {
                log.error("边民身份证:{},进出口预申报单号:{}",idNo,preleportNo);
                return null;
            }
        };
    }
}
