[重大更新] 使用 spring 新特性 HttpServiceClient 替代 Dubbo 降低框架使用难度(半成本 数据权限不好使)

This commit is contained in:
疯狂的狮子Li
2026-03-20 19:56:09 +08:00
parent 9cd198d99d
commit b6d2274b53
127 changed files with 1894 additions and 1496 deletions

View File

@@ -1,6 +1,5 @@
package org.dromara.system;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
@@ -10,7 +9,6 @@ import org.springframework.boot.context.metrics.buffering.BufferingApplicationSt
*
* @author ruoyi
*/
@EnableDubbo
@SpringBootApplication
public class RuoYiSystemApplication {
public static void main(String[] args) {

View File

@@ -2,7 +2,6 @@ package org.dromara.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.service.DictService;
import org.dromara.common.redis.annotation.RepeatSubmit;
@@ -32,8 +31,7 @@ public class SysNoticeController extends BaseController {
private final ISysNoticeService noticeService;
private final DictService dictService;
@DubboReference
private RemoteMessageService remoteMessageService;
private final RemoteMessageService remoteMessageService;
/**
* 获取通知公告列表

View File

@@ -6,7 +6,6 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.crypto.digest.BCrypt;
import jakarta.validation.constraints.NotBlank;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.seata.spring.annotation.GlobalTransactional;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.utils.StringUtils;
@@ -46,8 +45,7 @@ public class SysProfileController extends BaseController {
private final ISysUserService userService;
@DubboReference
private RemoteFileService remoteFileService;
private final RemoteFileService remoteFileService;
/**
* 个人信息

View File

@@ -1,13 +1,12 @@
package org.dromara.system.dubbo;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.system.api.RemoteClientService;
import org.dromara.system.api.domain.vo.RemoteClientVo;
import org.dromara.system.domain.vo.SysClientVo;
import org.dromara.system.service.ISysClientService;
import org.springframework.stereotype.Service;
/**
* 客户端服务
@@ -15,8 +14,7 @@ import org.springframework.stereotype.Service;
* @author Michelle.Chung
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemoteClientServiceImpl implements RemoteClientService {
private final ISysClientService sysClientService;

View File

@@ -2,11 +2,10 @@ package org.dromara.system.dubbo;
import cn.hutool.core.lang.Dict;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.common.json.utils.JsonUtils;
import org.dromara.system.api.RemoteConfigService;
import org.dromara.system.service.ISysConfigService;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -16,8 +15,7 @@ import java.util.List;
* @author Michelle.Chung
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemoteConfigServiceImpl implements RemoteConfigService {
private final ISysConfigService configService;

View File

@@ -5,7 +5,7 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.common.core.constant.CacheNames;
import org.dromara.common.core.utils.StreamUtils;
import org.dromara.system.api.RemoteDataScopeService;
@@ -13,7 +13,6 @@ import org.dromara.system.domain.SysRoleDept;
import org.dromara.system.mapper.SysDeptMapper;
import org.dromara.system.mapper.SysRoleDeptMapper;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -26,8 +25,7 @@ import java.util.List;
* @author Lion Li
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemoteDataScopeServiceImpl implements RemoteDataScopeService {
private final SysRoleDeptMapper roleDeptMapper;

View File

@@ -4,7 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.common.core.constant.SystemConstants;
import org.dromara.common.core.utils.StreamUtils;
import org.dromara.system.api.RemoteDeptService;
@@ -13,7 +13,6 @@ import org.dromara.system.domain.SysDept;
import org.dromara.system.domain.vo.SysDeptVo;
import org.dromara.system.mapper.SysDeptMapper;
import org.dromara.system.service.ISysDeptService;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.Collections;
@@ -26,8 +25,7 @@ import java.util.Map;
* @author Lion Li
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemoteDeptServiceImpl implements RemoteDeptService {
private final ISysDeptService deptService;

View File

@@ -1,7 +1,7 @@
package org.dromara.system.dubbo;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.system.api.RemoteDictService;
import org.dromara.system.api.domain.vo.RemoteDictDataVo;
@@ -9,7 +9,6 @@ import org.dromara.system.api.domain.vo.RemoteDictTypeVo;
import org.dromara.system.domain.vo.SysDictDataVo;
import org.dromara.system.domain.vo.SysDictTypeVo;
import org.dromara.system.service.ISysDictTypeService;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -19,8 +18,7 @@ import java.util.List;
* @author Lion Li
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemoteDictServiceImpl implements RemoteDictService {
private final ISysDictTypeService sysDictTypeService;

View File

@@ -1,7 +1,7 @@
package org.dromara.system.dubbo;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.system.api.RemoteLogService;
import org.dromara.system.api.domain.bo.RemoteLoginInfoBo;
@@ -11,7 +11,7 @@ import org.dromara.system.domain.bo.SysOperLogBo;
import org.dromara.system.service.ISysLoginInfoService;
import org.dromara.system.service.ISysOperLogService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
/**
* 操作日志记录
@@ -19,8 +19,7 @@ import org.springframework.stereotype.Service;
* @author Lion Li
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemoteLogServiceImpl implements RemoteLogService {
private final ISysOperLogService operLogService;
@@ -32,6 +31,7 @@ public class RemoteLogServiceImpl implements RemoteLogService {
* @param remoteOperLogBo 日志实体
*/
@Async
@PostMapping("/save-log")
@Override
public void saveLog(RemoteOperLogBo remoteOperLogBo) {
SysOperLogBo sysOperLogBo = MapstructUtils.convert(remoteOperLogBo, SysOperLogBo.class);
@@ -44,6 +44,7 @@ public class RemoteLogServiceImpl implements RemoteLogService {
* @param remoteLoginInfoBo 访问实体
*/
@Async
@PostMapping("/save-login-info")
@Override
public void saveLoginInfo(RemoteLoginInfoBo remoteLoginInfoBo) {
SysLoginInfoBo sysLoginInfoBo = MapstructUtils.convert(remoteLoginInfoBo, SysLoginInfoBo.class);

View File

@@ -1,10 +1,9 @@
package org.dromara.system.dubbo;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.system.api.RemotePermissionService;
import org.dromara.system.service.ISysPermissionService;
import org.springframework.stereotype.Service;
import java.util.Set;
@@ -14,8 +13,7 @@ import java.util.Set;
* @author Lion Li
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemotePermissionServiceImpl implements RemotePermissionService {
private final ISysPermissionService permissionService;

View File

@@ -3,12 +3,11 @@ package org.dromara.system.dubbo;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.common.core.utils.StreamUtils;
import org.dromara.system.api.RemotePostService;
import org.dromara.system.domain.SysPost;
import org.dromara.system.mapper.SysPostMapper;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.Collections;
@@ -21,8 +20,7 @@ import java.util.Map;
* @author Lion Li
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemotePostServiceImpl implements RemotePostService {
private final SysPostMapper postMapper;

View File

@@ -3,12 +3,11 @@ package org.dromara.system.dubbo;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.common.core.utils.StreamUtils;
import org.dromara.system.api.RemoteRoleService;
import org.dromara.system.domain.SysRole;
import org.dromara.system.mapper.SysRoleMapper;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.Collections;
@@ -21,8 +20,7 @@ import java.util.Map;
* @author Lion Li
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemoteRoleServiceImpl implements RemoteRoleService {
private final SysRoleMapper roleMapper;

View File

@@ -1,7 +1,7 @@
package org.dromara.system.dubbo;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.system.api.RemoteSocialService;
import org.dromara.system.api.domain.bo.RemoteSocialBo;
@@ -9,7 +9,6 @@ import org.dromara.system.api.domain.vo.RemoteSocialVo;
import org.dromara.system.domain.bo.SysSocialBo;
import org.dromara.system.domain.vo.SysSocialVo;
import org.dromara.system.service.ISysSocialService;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -19,8 +18,7 @@ import java.util.List;
* @author Michelle.Chung
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemoteSocialServiceImpl implements RemoteSocialService {
private final ISysSocialService sysSocialService;

View File

@@ -2,7 +2,7 @@ package org.dromara.system.dubbo;
import cn.hutool.core.convert.Convert;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.common.core.constant.SystemConstants;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.PageResult;
@@ -21,7 +21,6 @@ import org.dromara.system.service.ISysDeptService;
import org.dromara.system.service.ISysPostService;
import org.dromara.system.service.ISysRoleService;
import org.dromara.system.service.ISysUserService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@@ -32,8 +31,7 @@ import java.util.Map;
* @author Lion Li
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemoteTaskAssigneeServiceImpl implements RemoteTaskAssigneeService {
// 上级Service注入下级Service 其他Service永远不可能注入当前类 避免循环注入

View File

@@ -6,7 +6,7 @@ import cn.hutool.core.lang.Opt;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.common.http.annotation.RemoteServiceController;
import org.dromara.common.core.constant.SystemConstants;
import org.dromara.common.core.enums.UserStatus;
import org.dromara.common.core.exception.ServiceException;
@@ -32,7 +32,10 @@ import org.dromara.system.mapper.SysUserMapper;
import org.dromara.system.mapper.SysUserPostMapper;
import org.dromara.system.mapper.SysUserRoleMapper;
import org.dromara.system.service.*;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.PostExchange;
import java.util.*;
@@ -42,8 +45,7 @@ import java.util.*;
* @author Lion Li
*/
@RequiredArgsConstructor
@Service
@DubboService
@RemoteServiceController
public class RemoteUserServiceImpl implements RemoteUserService {
private final ISysUserService userService;