1.用户模块添加对外接口
This commit is contained in:
@@ -5,8 +5,10 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.user.api.fallback.UserFeignClientFallbackFactory;
|
||||
import com.njcn.user.pojo.dto.UserDTO;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -80,4 +82,7 @@ public interface UserFeignClient {
|
||||
*/
|
||||
@GetMapping("/getUserListByRoleCode")
|
||||
HttpResult<List<User>> getUserListByRoleCode(@RequestParam("roleCode") String roleCode);
|
||||
|
||||
@GetMapping("/getUserById")
|
||||
HttpResult<UserVO> getUserById(@RequestParam @Validated String id);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.dto.UserDTO;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.user.utils.UserEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -84,6 +85,12 @@ public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeign
|
||||
log.error("{}异常,降级处理,异常为:{}","根据角色Code集合查询用户信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<UserVO> getUserById(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据用户id获取用户详情",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user