diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteUserService.java b/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteUserService.java index 3793d5ceb..895893c38 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteUserService.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteUserService.java @@ -6,8 +6,6 @@ import org.dromara.system.api.domain.bo.RemoteUserBo; import org.dromara.system.api.domain.vo.RemoteUserVo; import org.dromara.system.api.model.LoginUser; import org.dromara.system.api.model.XcxLoginUser; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.*; import java.util.List; @@ -16,7 +14,6 @@ import java.util.List; * * @author Lion Li */ -@FeignClient(name = "user-service", url = "http://localhost:8081") public interface RemoteUserService { /** @@ -26,8 +23,7 @@ public interface RemoteUserService { * @param tenantId 租户id * @return 结果 */ - @PostMapping("/getUserInfoByUsernameTenantId") - LoginUser getUserInfoByUsernameTenantId(@RequestParam("username") String username, @RequestParam("tenantId") String tenantId) throws UserException; + LoginUser getUserInfo(String username, String tenantId) throws UserException; /** * 通过用户id查询用户信息 @@ -36,8 +32,7 @@ public interface RemoteUserService { * @param tenantId 租户id * @return 结果 */ - @PostMapping("/getUserInfo") - LoginUser getUserInfo(@RequestParam("userId") Long userId, @RequestParam("tenantId") String tenantId) throws UserException; + LoginUser getUserInfo(Long userId, String tenantId) throws UserException; /** * 通过手机号查询用户信息 @@ -46,8 +41,7 @@ public interface RemoteUserService { * @param tenantId 租户id * @return 结果 */ - @PostMapping("/getUserInfoByPhonenumber") - LoginUser getUserInfoByPhonenumber(@RequestParam("phonenumber") String phonenumber, @RequestParam("tenantId") String tenantId) throws UserException; + LoginUser getUserInfoByPhonenumber(String phonenumber, String tenantId) throws UserException; /** * 通过邮箱查询用户信息 @@ -56,8 +50,7 @@ public interface RemoteUserService { * @param tenantId 租户id * @return 结果 */ - @PostMapping("/getUserInfoByEmail") - LoginUser getUserInfoByEmail(@RequestParam("email") String email, @RequestParam("tenantId") String tenantId) throws UserException; + LoginUser getUserInfoByEmail(String email, String tenantId) throws UserException; /** * 通过openid查询用户信息 @@ -65,8 +58,7 @@ public interface RemoteUserService { * @param openid openid * @return 结果 */ - @PostMapping("/getUserInfoByOpenid") - XcxLoginUser getUserInfoByOpenid(@RequestParam("openid") String openid) throws UserException; + XcxLoginUser getUserInfoByOpenid(String openid) throws UserException; /** * 注册用户信息 @@ -74,8 +66,7 @@ public interface RemoteUserService { * @param remoteUserBo 用户信息 * @return 结果 */ - @PostMapping("/registerUserInfo") - Boolean registerUserInfo(@RequestBody RemoteUserBo remoteUserBo) throws UserException, ServiceException; + Boolean registerUserInfo(RemoteUserBo remoteUserBo) throws UserException, ServiceException; /** * 通过userId查询用户账户 @@ -83,8 +74,7 @@ public interface RemoteUserService { * @param userId 用户id * @return 结果 */ - @GetMapping("/selectUserNameById") - String selectUserNameById(@RequestParam("userId") Long userId); + String selectUserNameById(Long userId); /** * 通过用户ID查询用户昵称 @@ -92,8 +82,7 @@ public interface RemoteUserService { * @param userId 用户id * @return 结果 */ - @GetMapping("/selectNicknameById") - String selectNicknameById(@RequestParam("userId") Long userId); + String selectNicknameById(Long userId); /** * 通过用户ID查询用户账户 @@ -101,8 +90,7 @@ public interface RemoteUserService { * @param userIds 用户ID 多个用逗号隔开 * @return 用户名称 */ - @GetMapping("/selectNicknameByIds") - String selectNicknameByIds(@RequestParam("userIds") String userIds); + String selectNicknameByIds(String userIds); /** * 通过用户ID查询用户手机号 @@ -110,8 +98,7 @@ public interface RemoteUserService { * @param userId 用户id * @return 用户手机号 */ - @GetMapping("/selectPhonenumberById") - String selectPhonenumberById(@RequestParam("userId") Long userId); + String selectPhonenumberById(Long userId); /** * 通过用户ID查询用户邮箱 @@ -119,8 +106,7 @@ public interface RemoteUserService { * @param userId 用户id * @return 用户邮箱 */ - @GetMapping("/selectEmailById") - String selectEmailById(@RequestParam("userId") Long userId); + String selectEmailById(Long userId); /** * 更新用户信息 @@ -128,8 +114,7 @@ public interface RemoteUserService { * @param userId 用户ID * @param ip IP地址 */ - @PostMapping("/recordLoginInfo") - void recordLoginInfo(@RequestParam("userId") Long userId, @RequestParam("ip") String ip); + void recordLoginInfo(Long userId, String ip); /** * 通过用户ID查询用户列表 @@ -137,8 +122,7 @@ public interface RemoteUserService { * @param userIds 用户ids * @return 用户列表 */ - @PostMapping("/selectListByIds") - List selectListByIds(@RequestBody List userIds); + List selectListByIds(List userIds); /** * 通过角色ID查询用户ID @@ -146,6 +130,5 @@ public interface RemoteUserService { * @param roleIds 角色ids * @return 用户ids */ - @PostMapping("/selectUserIdsByRoleIds") - List selectUserIdsByRoleIds(@RequestBody List roleIds); -} \ No newline at end of file + List selectUserIdsByRoleIds(List roleIds); +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/config/ClientInfoUtil.java b/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/config/ClientInfoUtil.java deleted file mode 100644 index dadf95822..000000000 --- a/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/config/ClientInfoUtil.java +++ /dev/null @@ -1,22 +0,0 @@ -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletRequest; -import java.net.InetAddress; -import java.net.UnknownHostException; - -@Component -public class ClientInfoUtil { - - public String getCurrentSystemIp() { - try { - return InetAddress.getLocalHost().getHostAddress(); - } catch (UnknownHostException e) { - e.printStackTrace(); - return "unknown"; - } - } - - public String getClientType(HttpServletRequest request) { - return request.getHeader("Client-Type"); - } -} \ No newline at end of file diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/config/FeignConfig.java b/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/config/FeignConfig.java deleted file mode 100644 index 3df3696be..000000000 --- a/ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/config/FeignConfig.java +++ /dev/null @@ -1,34 +0,0 @@ -import feign.RequestInterceptor; -import feign.RequestTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - -import javax.servlet.http.HttpServletRequest; - -@Configuration -public class FeignConfig { - - @Autowired - private ClientInfoUtil clientInfoUtil; - - @Bean - public RequestInterceptor requestInterceptor() { - return new RequestInterceptor() { - @Override - public void apply(RequestTemplate template) { - // 获取客户端类型 - String clientType = clientInfoUtil.getClientType(request); - - // 获取当前系统的IP - String currentSystemIp = clientInfoUtil.getCurrentSystemIp(); - - // 将客户端信息添加到请求头 - template.header("X-Client-IP", currentSystemIp); - template.header("X-Client-Type", clientType); - } - }; - } -} \ No newline at end of file