package com.hw.system.api.factory;

import com.hw.common.core.domain.R;
import com.hw.system.api.RemoteSysCommonService;
import com.hw.system.api.RemoteUserService;
import com.hw.system.api.domain.SysUser;
import com.hw.system.api.domain.common.WfProcessActivity;
import com.hw.system.api.domain.common.vo.WfProcessActivityVo;
import com.hw.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.rmi.Remote;

/**
 * 日志服务降级处理
 *
 * @author ruoyi
 */
@Component
public class RemoteSysCommonFallbackFactory implements FallbackFactory<RemoteSysCommonService> {

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

    @Override
    public RemoteSysCommonService create(Throwable throwable) {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteSysCommonService() {


            @Override
            public R<?> selectWfProcessActivity(String source, WfProcessActivity wfProcessActivity) {
                return null;
            }

            @Override
            public Long selectProcessActivityIdByWfProcessId(String source, Long wfProcessId) {
                return null;
            }

            @Override
            public R<WfProcessActivity> getWfProcessActivityByUI(WfProcessActivityVo wfProcessActivityVo, String source) {
                return R.fail("获取工单流程步骤失败:" + throwable.getMessage());
            }


        };
    }
}
