Skip to content

Commit

Permalink
!551 ♥️发布 5.2.0 正式版本
Browse files Browse the repository at this point in the history
Merge pull request !551 from 疯狂的狮子Li/dev
  • Loading branch information
JavaLionLi authored and gitee-org committed Jun 20, 2024
2 parents 456620b + b27f560 commit 0b33179
Show file tree
Hide file tree
Showing 23 changed files with 150 additions and 75 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![使用IntelliJ IDEA开发维护](https://img.shields.io/badge/IntelliJ%20IDEA-提供支持-blue.svg)](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
<br>
[![RuoYi-Vue-Plus](https://img.shields.io/badge/RuoYi_Vue_Plus-5.2.0-success.svg)](https://gitee.com/dromara/RuoYi-Vue-Plus)
[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.1-blue.svg)]()
[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.2-blue.svg)]()
[![JDK-17](https://img.shields.io/badge/JDK-17-green.svg)]()
[![JDK-21](https://img.shields.io/badge/JDK-21-green.svg)]()

Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<description>RuoYi-Vue-Plus多租户管理系统</description>

<properties>
<revision>5.2.0-BETA2</revision>
<revision>5.2.0</revision>
<spring-boot.version>3.2.6</spring-boot.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand All @@ -25,16 +25,16 @@
<easyexcel.version>3.3.4</easyexcel.version>
<velocity.version>2.3</velocity.version>
<satoken.version>1.38.0</satoken.version>
<mybatis-plus.version>3.5.6</mybatis-plus.version>
<mybatis-plus.version>3.5.7</mybatis-plus.version>
<p6spy.version>3.9.1</p6spy.version>
<hutool.version>5.8.27</hutool.version>
<okhttp.version>4.10.0</okhttp.version>
<spring-boot-admin.version>3.2.3</spring-boot-admin.version>
<redisson.version>3.29.0</redisson.version>
<redisson.version>3.31.0</redisson.version>
<lock4j.version>2.2.7</lock4j.version>
<dynamic-ds.version>4.3.0</dynamic-ds.version>
<dynamic-ds.version>4.3.1</dynamic-ds.version>
<alibaba-ttl.version>2.14.4</alibaba-ttl.version>
<snailjob.version>1.0.0-beta3</snailjob.version>
<snailjob.version>1.0.1</snailjob.version>
<mapstruct-plus.version>1.3.6</mapstruct-plus.version>
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
<lombok.version>1.18.32</lombok.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.dromara.web.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import jakarta.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -42,7 +43,10 @@
import org.springframework.web.bind.annotation.*;

import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -112,13 +116,18 @@ public R<LoginVo> login(@RequestBody String body) {
* @return 结果
*/
@GetMapping("/binding/{source}")
public R<String> authBinding(@PathVariable("source") String source) {
public R<String> authBinding(@PathVariable("source") String source,
@RequestParam String tenantId, @RequestParam String domain) {
SocialLoginConfigProperties obj = socialProperties.getType().get(source);
if (ObjectUtil.isNull(obj)) {
return R.fail(source + "平台账号暂不支持");
}
AuthRequest authRequest = SocialUtils.getAuthRequest(source, socialProperties);
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
Map<String, String> map = new HashMap<>();
map.put("tenantId", tenantId);
map.put("domain", domain);
map.put("state", AuthStateUtils.createState());
String authorizeUrl = authRequest.authorize(Base64.encode(JsonUtils.toJsonString(map), StandardCharsets.UTF_8));
return R.ok("操作成功", authorizeUrl);
}

Expand Down
2 changes: 2 additions & 0 deletions ruoyi-admin/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ snail-job:
port: 1788
# 详见 script/sql/snail_job.sql `sj_namespace` 表
namespace: ${spring.profiles.active}
# 随主应用端口飘逸
port: 2${server.port}

--- # 数据源配置
spring:
Expand Down
2 changes: 2 additions & 0 deletions ruoyi-admin/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ snail-job:
port: 1788
# 详见 script/sql/snail_job.sql `sj_namespace` 表
namespace: ${spring.profiles.active}
# 随主应用端口飘逸
port: 2${server.port}

--- # 数据源配置
spring:
Expand Down
2 changes: 1 addition & 1 deletion ruoyi-common/ruoyi-common-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</description>

<properties>
<revision>5.2.0-BETA2</revision>
<revision>5.2.0</revision>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
* @author Lion Li
*/
@AutoConfiguration
// 表示通过aop框架暴露该代理对象,AopContext能够访问
@EnableAspectJAutoProxy(exposeProxy = true)
@EnableAspectJAutoProxy
@EnableAsync(proxyTargetClass = true)
public class ApplicationConfig {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ public class ProcessTaskEvent implements Serializable {
private static final long serialVersionUID = 1L;

/**
* 流程定义key与流程节点标识(拼接方式:流程定义key_流程节点)
* 流程定义key
*/
private String keyNode;
private String key;

/**
* 审批节点key
*/
private String taskDefinitionKey;

/**
* 任务id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.dromara.common.core.utils;

import cn.hutool.extra.spring.SpringUtil;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.autoconfigure.thread.Threading;
import org.springframework.context.ApplicationContext;
Expand Down Expand Up @@ -50,7 +49,7 @@ public static String[] getAliases(String name) throws NoSuchBeanDefinitionExcept
*/
@SuppressWarnings("unchecked")
public static <T> T getAopProxy(T invoker) {
return (T) AopContext.currentProxy();
return (T) getBean(invoker.getClass());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class LogAspect {
* 处理请求前执行
*/
@Before(value = "@annotation(controllerLog)")
public void boBefore(JoinPoint joinPoint, Log controllerLog) {
public void doBefore(JoinPoint joinPoint, Log controllerLog) {
StopWatch stopWatch = new StopWatch();
KEY_CACHE.set(stopWatch);
stopWatch.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,49 +50,54 @@ default List<T> selectList() {
* 批量插入
*/
default boolean insertBatch(Collection<T> entityList) {
return Db.saveBatch(entityList);
Db.saveBatch(entityList);
// 临时解决 新版本 mp 插入状态判断错误问题
return true;
}

/**
* 批量更新
*/
default boolean updateBatchById(Collection<T> entityList) {
return Db.updateBatchById(entityList);
Db.updateBatchById(entityList);
// 临时解决 新版本 mp 插入状态判断错误问题
return true;
}

/**
* 批量插入或更新
*/
default boolean insertOrUpdateBatch(Collection<T> entityList) {
return Db.saveOrUpdateBatch(entityList);
Db.saveOrUpdateBatch(entityList);
// 临时解决 新版本 mp 插入状态判断错误问题
return true;
}

/**
* 批量插入(包含限制条数)
*/
default boolean insertBatch(Collection<T> entityList, int batchSize) {
return Db.saveBatch(entityList, batchSize);
Db.saveBatch(entityList, batchSize);
// 临时解决 新版本 mp 插入状态判断错误问题
return true;
}

/**
* 批量更新(包含限制条数)
*/
default boolean updateBatchById(Collection<T> entityList, int batchSize) {
return Db.updateBatchById(entityList, batchSize);
Db.updateBatchById(entityList, batchSize);
// 临时解决 新版本 mp 插入状态判断错误问题
return true;
}

/**
* 批量插入或更新(包含限制条数)
*/
default boolean insertOrUpdateBatch(Collection<T> entityList, int batchSize) {
return Db.saveOrUpdateBatch(entityList, batchSize);
}

/**
* 插入或更新(包含限制条数)
*/
default boolean insertOrUpdate(T entity) {
return Db.saveOrUpdate(entity);
Db.saveOrUpdateBatch(entityList, batchSize);
// 临时解决 新版本 mp 插入状态判断错误问题
return true;
}

default V selectVoById(Serializable id) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.dromara.common.websocket.handler;

import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.websocket.dto.WebSocketMessageDto;
Expand All @@ -8,6 +9,7 @@
import org.springframework.web.socket.*;
import org.springframework.web.socket.handler.AbstractWebSocketHandler;

import java.io.IOException;
import java.util.List;

import static org.dromara.common.websocket.constant.WebSocketConstants.LOGIN_USER_KEY;
Expand All @@ -24,8 +26,13 @@ public class PlusWebSocketHandler extends AbstractWebSocketHandler {
* 连接成功后
*/
@Override
public void afterConnectionEstablished(WebSocketSession session) {
public void afterConnectionEstablished(WebSocketSession session) throws IOException {
LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY);
if (ObjectUtil.isNull(loginUser)) {
session.close(CloseStatus.BAD_DATA);
log.info("[connect] invalid token received. sessionId: {}", session.getId());
return;
}
WebSocketSessionHolder.addSession(loginUser.getUserId(), session);
log.info("[connect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType());
}
Expand Down Expand Up @@ -94,6 +101,10 @@ public void handleTransportError(WebSocketSession session, Throwable exception)
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) {
LoginUser loginUser = (LoginUser) session.getAttributes().get(LOGIN_USER_KEY);
if (ObjectUtil.isNull(loginUser)) {
log.info("[disconnect] invalid token received. sessionId: {}", session.getId());
return;
}
WebSocketSessionHolder.removeSession(loginUser.getUserId());
log.info("[disconnect] sessionId: {},userId:{},userType:{}", session.getId(), loginUser.getUserId(), loginUser.getUserType());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package org.dromara.common.websocket.interceptor;

import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.stp.StpUtil;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.core.utils.ServletUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.satoken.utils.LoginHelper;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
Expand Down Expand Up @@ -31,7 +35,21 @@ public class PlusWebSocketInterceptor implements HandshakeInterceptor {
*/
@Override
public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) {
// 检查是否登录 是否有token
LoginUser loginUser = LoginHelper.getLoginUser();

// 解决 ws 不走 mvc 拦截器问题(cloud 版本不受影响)
// 检查 header 与 param 里的 clientid 与 token 里的是否一致
String headerCid = ServletUtils.getRequest().getHeader(LoginHelper.CLIENT_KEY);
String paramCid = ServletUtils.getParameter(LoginHelper.CLIENT_KEY);
String clientId = StpUtil.getExtra(LoginHelper.CLIENT_KEY).toString();
if (!StringUtils.equalsAny(clientId, headerCid, paramCid)) {
// token 无效
throw NotLoginException.newInstance(StpUtil.getLoginType(),
"-100", "客户端ID与Token不匹配",
StpUtil.getTokenValue());
}

attributes.put(LOGIN_USER_KEY, loginUser);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import cn.hutool.core.collection.CollUtil;
import org.dromara.common.core.domain.dto.OssDTO;
import org.dromara.common.core.service.OssService;
import org.dromara.common.core.utils.SpringUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.satoken.utils.LoginHelper;
import org.flowable.common.engine.impl.interceptor.Command;
Expand All @@ -28,17 +27,20 @@ public class AttachmentCmd implements Command<Boolean> {

private final String processInstanceId;

public AttachmentCmd(String fileId, String taskId, String processInstanceId) {
private final OssService ossService;

public AttachmentCmd(String fileId, String taskId, String processInstanceId, OssService ossService) {
this.fileId = fileId;
this.taskId = taskId;
this.processInstanceId = processInstanceId;
this.ossService = ossService;
}

@Override
public Boolean execute(CommandContext commandContext) {
try {
if (StringUtils.isNotBlank(fileId)) {
List<OssDTO> ossList = SpringUtils.getBean(OssService.class).selectByIds(fileId);
List<OssDTO> ossList = ossService.selectByIds(fileId);
if (CollUtil.isNotEmpty(ossList)) {
for (OssDTO oss : ossList) {
AttachmentEntityManager attachmentEntityManager = CommandContextUtil.getAttachmentEntityManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ public void processHandler(String key, String businessKey, String status, boolea
/**
* 执行办理任务监听
*
* @param keyNode 流程定义key与流程节点标识(拼接方式:流程定义key_流程节点)
* @param taskId 任务id
* @param businessKey 业务id
* @param key 流程key
* @param taskDefinitionKey 审批节点key
* @param taskId 任务id
* @param businessKey 业务id
*/
public void processTaskHandler(String keyNode, String taskId, String businessKey) {
public void processTaskHandler(String key, String taskDefinitionKey, String taskId, String businessKey) {
ProcessTaskEvent processTaskEvent = new ProcessTaskEvent();
processTaskEvent.setKeyNode(keyNode);
processTaskEvent.setKey(key);
processTaskEvent.setTaskDefinitionKey(taskDefinitionKey);
processTaskEvent.setTaskId(taskId);
processTaskEvent.setBusinessKey(businessKey);
SpringUtils.context().publishEvent(processTaskEvent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.workflow.domain.TestLeave;
import org.dromara.workflow.domain.bo.TestLeaveBo;
import org.dromara.workflow.domain.vo.TestLeaveVo;

Expand Down
Loading

0 comments on commit 0b33179

Please sign in to comment.