package com.jeeplus.sys.factory;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.Lists;
import com.jeeplus.sys.domain.User;
import com.jeeplus.sys.feign.IUserApi;
import com.jeeplus.sys.service.dto.CertDTO;
import com.jeeplus.sys.service.dto.DataRuleDTO;
import com.jeeplus.sys.service.dto.UserDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;
import java.util.*;

/**
 * 用户服务降级处理
 *
 * @author jeeplus
 */
@Slf4j
@Component
public class UserApiFallbackFactory implements FallbackFactory <IUserApi> {
    @Override
    public IUserApi create(Throwable throwable) {
        log.error ( "用户服务调用失败:{}", throwable.getMessage ( ) );
        throwable.printStackTrace ( );
        return new IUserApi ( ) {
            @Override
            public List<UserDTO> getAllUserInfos() {
                return null;
            }

            @Override
            public Integer selectCountByMobile(String mobile) {
                return null;
            }

            @Override
            public Integer selectCountByMobileByTenantId(String mobile,String tenantId,String userId) {
                return null;
            }

            @Override
            public Map<String, Object> sendRandomCodes(String mobile, String randomCode) throws Exception {
                return null;
            }

            @Override
            public Map<String, Object> sendEntryRandomCodes(String phoneNumbers, String name, String officeName, String rkeAdmin, String tenantId) throws Exception {
                return null;
            }

            @Override
            public Map<String, Object> sendInternshipEntryRandomCodes(String mobile, String name, String officeName) throws Exception {
                return null;
            }

            @Override
            public Map<String, Object> sendInternshipFinishRandomCodes(String mobile, String name, String time) throws Exception {
                return null;
            }

            @Override
            public Map<String, Object> sendEntryRandomCodesByInvoice(String mobile, String unitName, String number, String result, String smsCode) throws Exception {
                return null;
            }

            public UserDTO getByLoginName(String loginName, String tenantId) {
                return null;
            }

            @Override
            public UserDTO getByOidcIdentity(String issuer, String subject, String loginName, String tenantId) {
                return null;
            }

            @Override
            public UserDTO getByLoginNameNoTen(String loginName) {
                return null;
            }

            public UserDTO getByLoginNameNotTenantId(String loginName) {
                return null;
            }

            public void clearCache(UserDTO userDTO) {

            }

            public List <DataRuleDTO> getDataRuleList(UserDTO userDTO) {
                return Lists.newArrayList ( );
            }

            @Override
            public void updateUser(UserDTO userDTO) {

            }

            @Override
            public void deleteById(String id) {

            }

            @Override
            public Set <String> getPermissions(String loginName) {
                return new HashSet <> ( );
            }

            @Override
            public UserDTO getByToken(String token) {
                return null;
            }

            @Override
            public UserDTO getById(String id) {
                return null;
            }

            @Override
            public UserDTO getByOpenId(String openId) {
                return null;
            }

            @Override
            public UserDTO getByDdId(String ddId) {
                return null;
            }

            @Override
            public UserDTO getByDdIdAndTenantId(String ddId, String tenantId) {
                return null;
            }

            @Override
            public String getOpenIdsByIds(String userIds) {
                return null;
            }

            @Override
            public String getNamesByIds(String userIds) {
                return null;
            }

            @Override
            public String getByIdForXXL(String id) {
                return null;
            }

            @Override
            public UserDTO getFlowAbleById(String id) {
                return null;
            }

            @Override
            public List <UserDTO> findListByPostId(String postId) {
                return Lists.newArrayList ( );
            }

            @Override
            public List<UserDTO> getAllUserInfo() {
                return null;
            }

            @Override
            public List <UserDTO> findListFlowAbleByPostId(String postId) {
                return Lists.newArrayList ( );
            }

            @Override
            public List<String> findIdListFlowAbleByPostId(String postId) {
                return null;
            }

            @Override
            public List <UserDTO> findListByRoleId(String roleId) {
                return Lists.newArrayList ( );
            }

            @Override
            public List <UserDTO> findListByCompanyId(String companyId) {
                return Lists.newArrayList ( );
            }

            @Override
            public List <UserDTO> findListByOfficeId(String officeId) {
                return Lists.newArrayList ( );
            }

            @Override
            public boolean isEnableLogin(String tenantId, String username) {
                return true;
            }

            @Override
            public UserDTO getUserDTOByName(String name) {
                return null;
            }

            @Override
            public void updateUserUpPassword(UserDTO userDTO) {

            }

            @Override
            public String getSysParam(String parameter,String token) {
                return null;
            }

            @Override
            public List<CertDTO> getCertListByUserId() {
                return null;
            }

            @Override
            public String getFileDir(String url) {
                return null;
            }

            @Override
            public boolean delFile(String id) {
                return false;
            }

            @Override
            public List<UserDTO> getUserInfoByEnName(String enName) {
                return null;
            }

            @Override
            public List<User> selectListByName(String name) {
                return null;
            }

            @Override
            public List<User> findListByLikeName(String name) {
                return null;
            }

            @Override
            public List<User> getUserByOfficeAll(String operatorOffice) {
                return null;
            }

            @Override
            public IPage<UserDTO> findPage() {
                return null;
            }

            @Override
            public void saveOrUpdate(UserDTO userDTO) {

            }

            @Override
            public String enterpriseSearchByName(String keyword) {
                return null;
            }

            @Override
            public String enterpriseTicketInfoQueryById(String id) {
                return null;
            }

            @Override
            public String getUserIdByName(String name) {
                return null;
            }

            @Override
            public String getUserIdByUserName(String name) {
                return null;
            }

            @Override
            public Integer getUserPostCountById(String id) {
                return null;
            }

            @Override
            public List<String> hasUser() {
                return null;
            }

            @Override
            public List <UserDTO> getAllUserInfoNoTenId() {
                return null;
            }

            @Override
            public void updateUserById(UserDTO dto) {

            }

            @Override
            public UserDTO getByMobile(String mobilePhone) {
                return null;
            }

            @Override
            public UserDTO selectByMobile(String mobilePhone) {
                return null;
            }

            @Override
            public String getManageOfficeIdsById(String id) {
                return null;
            }

            @Override
            public List<UserDTO> getOnLineUserList(String loginName, String tenantId) {
                return null;
            }

            @Override
            public void logoutByUserAll() {

            }

            @Override
            public UserDTO findCountById(String id) {
                return null;
            }

            @Override
            public void addDefaultSignatureCount(String userId) {

            }

        };
    }
}
