1.用户模块添加对外接口

This commit is contained in:
cdf
2024-03-25 18:21:23 +08:00
parent 1c06a03166
commit 339dbf1004
2 changed files with 12 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -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);
}
};
}
}