|
@@ -1,48 +0,0 @@
|
|
|
-package com.usky.demo.factory;
|
|
|
-
|
|
|
-import com.usky.common.core.bean.ApiResult;
|
|
|
-import com.usky.common.core.exception.BusinessException;
|
|
|
-import com.usky.demo.RemoteUserService;
|
|
|
-import com.usky.demo.domain.SysUserVO;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-
|
|
|
-import org.springframework.cloud.openfeign.FallbackFactory;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- * 用户服务降级处理
|
|
|
- *
|
|
|
- * @author ruoyi
|
|
|
- */
|
|
|
-@Component
|
|
|
-public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService>
|
|
|
-{
|
|
|
- private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class);
|
|
|
-
|
|
|
- @Override
|
|
|
- public RemoteUserService create(Throwable throwable)
|
|
|
- {
|
|
|
- log.error("用户服务调用失败:{}", throwable.getMessage());
|
|
|
- return new RemoteUserService() {
|
|
|
- @Override
|
|
|
- public ApiResult<List<SysUserVO>> getByUserName(String userName) {
|
|
|
- throw new BusinessException(throwable.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public ApiResult<List<SysUserVO>> add(SysUserVO sysUserVO) {
|
|
|
- throw new BusinessException(throwable.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public ApiResult<String> upload(MultipartFile file) {
|
|
|
- throw new BusinessException(throwable.getMessage());
|
|
|
- }
|
|
|
- };
|
|
|
- }
|
|
|
-}
|