package cn.estsh.i3plus.ext.mes.pcn.icloud.sdkfallback;

import cn.estsh.i3plus.ext.mes.pcn.icloud.sdk.IWmsJobBookingCloud;
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesWorkOverModel;
import cn.estsh.i3plus.pojo.base.bean.BaseFallBackBean;
import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Component
public class WmsJobBookingFallbackFactory extends BaseFallBackBean implements FallbackFactory<IWmsJobBookingCloud> {
    @Override
    public IWmsJobBookingCloud create(Throwable throwable) {
        return new IWmsJobBookingCloud() {
            @Override
            public BaseResultBean doMesWorkOver(@RequestBody List<MesWorkOverModel> wmsPsCheckModelList, @RequestParam("userName") String userName, @RequestParam("organizeCode") String organizeCode) {
                return makeBaseFallBack("微服调用出错", throwable);
            }
        };
    }
}
