mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-04-09 03:53:15 +08:00
update 优化 统一补全代码注释
This commit is contained in:
@@ -28,6 +28,8 @@ public class ThreadPoolConfig {
|
||||
|
||||
/**
|
||||
* 执行周期性或定时任务
|
||||
*
|
||||
* @return 全局定时任务线程池
|
||||
*/
|
||||
@Bean(name = "scheduledExecutorService")
|
||||
protected ScheduledExecutorService scheduledExecutorService() {
|
||||
@@ -85,6 +87,9 @@ public class ThreadPoolConfig {
|
||||
|
||||
/**
|
||||
* 打印线程异常信息
|
||||
*
|
||||
* @param r 已执行的任务
|
||||
* @param t 任务执行过程中抛出的异常
|
||||
*/
|
||||
public static void printException(Runnable r, Throwable t) {
|
||||
if (t == null && r instanceof Future<?>) {
|
||||
|
||||
@@ -20,6 +20,9 @@ public class ValidatorConfig {
|
||||
|
||||
/**
|
||||
* 配置校验框架 快速失败模式
|
||||
*
|
||||
* @param messageSource 国际化消息源
|
||||
* @return 启用快速失败模式的校验器
|
||||
*/
|
||||
@Bean
|
||||
public Validator validator(MessageSource messageSource) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.dromara.common.core.constant;
|
||||
|
||||
/**
|
||||
* 缓存的key 常量
|
||||
* Redis 缓存键前缀常量。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.dromara.common.core.constant;
|
||||
|
||||
/**
|
||||
* 缓存组名称常量
|
||||
* 缓存组名称常量,统一约定缓存名和缓存策略配置格式。
|
||||
* <p>
|
||||
* key 格式为 cacheNames#ttl#maxIdleTime#maxSize#local
|
||||
* <p>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.dromara.common.core.constant;
|
||||
|
||||
/**
|
||||
* 通用常量信息
|
||||
* 通用基础常量定义。
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.dromara.common.core.constant;
|
||||
|
||||
/**
|
||||
* 全局的key常量 (业务无关的key)
|
||||
* 全局通用键常量,主要用于业务无关的 Redis Key 前缀定义。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@@ -65,6 +65,11 @@ public class CompleteTaskDTO implements Serializable {
|
||||
*/
|
||||
private String ext;
|
||||
|
||||
/**
|
||||
* 获取流程变量并自动剔除空值。
|
||||
*
|
||||
* @return 流程变量
|
||||
*/
|
||||
public Map<String, Object> getVariables() {
|
||||
if (variables == null) {
|
||||
variables = new HashMap<>(16);
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* OSS对象
|
||||
* OSS 文件简要信息对象。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 岗位
|
||||
* 岗位简要信息对象。
|
||||
*
|
||||
* @author AprilWind
|
||||
*/
|
||||
|
||||
@@ -7,11 +7,10 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
* 角色简要信息对象。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class RoleDTO implements Serializable {
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 启动流程对象
|
||||
* 启动流程请求对象。
|
||||
*
|
||||
* @author may
|
||||
*/
|
||||
@@ -46,6 +46,11 @@ public class StartProcessDTO implements Serializable {
|
||||
*/
|
||||
private FlowInstanceBizExtDTO bizExt;
|
||||
|
||||
/**
|
||||
* 获取流程变量并自动剔除空值。
|
||||
*
|
||||
* @return 流程变量
|
||||
*/
|
||||
public Map<String, Object> getVariables() {
|
||||
if (variables == null) {
|
||||
variables = new HashMap<>(16);
|
||||
@@ -55,6 +60,11 @@ public class StartProcessDTO implements Serializable {
|
||||
return variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程业务扩展信息,为空时返回默认对象。
|
||||
*
|
||||
* @return 业务扩展信息
|
||||
*/
|
||||
public FlowInstanceBizExtDTO getBizExt() {
|
||||
if (ObjectUtil.isNull(bizExt)) {
|
||||
bizExt = new FlowInstanceBizExtDTO();
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 启动流程返回对象
|
||||
* 启动流程后的返回结果对象。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TaskAssigneeDTO implements Serializable {
|
||||
private Long total = 0L;
|
||||
|
||||
/**
|
||||
*
|
||||
* 受让人列表。
|
||||
*/
|
||||
private List<TaskHandler> list;
|
||||
|
||||
@@ -67,6 +67,9 @@ public class TaskAssigneeDTO implements Serializable {
|
||||
)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务受让人明细对象。
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
@@ -7,11 +7,10 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 当前在线会话
|
||||
* 当前在线会话信息对象。
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class UserOnlineDTO implements Serializable {
|
||||
|
||||
@@ -6,11 +6,10 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 邮件登录对象
|
||||
* 邮箱验证码登录请求对象。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EmailLoginBody extends LoginBody {
|
||||
|
||||
@@ -7,11 +7,10 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 用户登录对象
|
||||
* 通用登录请求对象,封装客户端、授权类型和验证码信息。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class LoginBody implements Serializable {
|
||||
|
||||
@@ -36,7 +35,7 @@ public class LoginBody implements Serializable {
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 唯一标识
|
||||
* 验证码唯一标识。
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 登录用户身份权限
|
||||
* 登录用户上下文对象,保存当前会话的身份、权限和终端信息。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@@ -134,7 +134,9 @@ public class LoginUser implements Serializable {
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* 获取登录id
|
||||
* 获取 Sa-Token 使用的登录标识。
|
||||
*
|
||||
* @return 登录标识
|
||||
*/
|
||||
public String getLoginId() {
|
||||
if (userType == null) {
|
||||
|
||||
@@ -5,11 +5,10 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 短信登录对象
|
||||
* 短信验证码登录请求对象。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SmsLoginBody extends LoginBody {
|
||||
|
||||
@@ -5,11 +5,10 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 三方登录对象
|
||||
* 第三方平台登录绑定请求对象。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SocialLoginBody extends LoginBody {
|
||||
|
||||
@@ -5,11 +5,10 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 三方登录对象
|
||||
* 小程序登录请求对象。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class XcxLoginBody extends LoginBody {
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.NoArgsConstructor;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 小程序登录用户身份权限
|
||||
* 小程序登录用户上下文对象。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@@ -20,7 +20,7 @@ public class XcxLoginUser extends LoginUser {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* openid
|
||||
* 小程序 openid。
|
||||
*/
|
||||
private String openid;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 业务状态枚举
|
||||
* 流程业务状态枚举,统一定义单据在审批流转中的状态。
|
||||
*
|
||||
* @author may
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
* 登录设备类型枚举。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 登录类型
|
||||
* 登录类型枚举,同时维护不同登录方式对应的重试提示配置。
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,14 @@ public enum UserStatus {
|
||||
*/
|
||||
DELETED("2", "删除");
|
||||
|
||||
/**
|
||||
* 状态编码。
|
||||
*/
|
||||
private final String code;
|
||||
|
||||
/**
|
||||
* 状态说明。
|
||||
*/
|
||||
private final String info;
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,12 @@ public enum UserType {
|
||||
*/
|
||||
private final String userType;
|
||||
|
||||
/**
|
||||
* 根据字符串内容匹配用户类型。
|
||||
*
|
||||
* @param str 待匹配字符串
|
||||
* @return 用户类型
|
||||
*/
|
||||
public static UserType getUserType(String str) {
|
||||
for (UserType value : values()) {
|
||||
if (StringUtils.contains(str, value.getUserType())) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 业务异常(支持占位符 {} )
|
||||
* 通用业务异常,支持使用占位符拼接错误信息。
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@@ -37,15 +37,32 @@ public final class ServiceException extends RuntimeException {
|
||||
*/
|
||||
private String detailMessage;
|
||||
|
||||
/**
|
||||
* 使用错误消息构造业务异常。
|
||||
*
|
||||
* @param message 错误消息
|
||||
*/
|
||||
public ServiceException(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用错误消息和错误码构造业务异常。
|
||||
*
|
||||
* @param message 错误消息
|
||||
* @param code 错误码
|
||||
*/
|
||||
public ServiceException(String message, Integer code) {
|
||||
this.message = message;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用占位符参数格式化错误消息。
|
||||
*
|
||||
* @param message 模板消息
|
||||
* @param args 参数
|
||||
*/
|
||||
public ServiceException(String message, Object... args) {
|
||||
this.message = StrFormatter.format(message, args);
|
||||
}
|
||||
@@ -55,11 +72,23 @@ public final class ServiceException extends RuntimeException {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置错误消息并返回当前异常对象。
|
||||
*
|
||||
* @param message 错误消息
|
||||
* @return 当前异常对象
|
||||
*/
|
||||
public ServiceException setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置错误明细并返回当前异常对象。
|
||||
*
|
||||
* @param detailMessage 错误明细
|
||||
* @return 当前异常对象
|
||||
*/
|
||||
public ServiceException setDetailMessage(String detailMessage) {
|
||||
this.detailMessage = detailMessage;
|
||||
return this;
|
||||
|
||||
@@ -8,7 +8,7 @@ import lombok.NoArgsConstructor;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* sse 特制异常
|
||||
* SSE 场景专用异常。
|
||||
*
|
||||
* @author LionLi
|
||||
*/
|
||||
@@ -36,10 +36,21 @@ public final class SseException extends RuntimeException {
|
||||
*/
|
||||
private String detailMessage;
|
||||
|
||||
/**
|
||||
* 使用错误消息构造 SSE 异常。
|
||||
*
|
||||
* @param message 错误消息
|
||||
*/
|
||||
public SseException(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用错误消息和错误码构造 SSE 异常。
|
||||
*
|
||||
* @param message 错误消息
|
||||
* @param code 错误码
|
||||
*/
|
||||
public SseException(String message, Integer code) {
|
||||
this.message = message;
|
||||
this.code = code;
|
||||
@@ -50,11 +61,23 @@ public final class SseException extends RuntimeException {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置错误消息并返回当前异常对象。
|
||||
*
|
||||
* @param message 错误消息
|
||||
* @return 当前异常对象
|
||||
*/
|
||||
public SseException setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置错误明细并返回当前异常对象。
|
||||
*
|
||||
* @param detailMessage 错误明细
|
||||
* @return 当前异常对象
|
||||
*/
|
||||
public SseException setDetailMessage(String detailMessage) {
|
||||
this.detailMessage = detailMessage;
|
||||
return this;
|
||||
|
||||
@@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 基础异常
|
||||
* 基础国际化异常,支持按错误码解析最终提示信息。
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@@ -43,18 +43,42 @@ public class BaseException extends RuntimeException {
|
||||
*/
|
||||
private String defaultMessage;
|
||||
|
||||
/**
|
||||
* 使用模块、错误码和参数构造异常。
|
||||
*
|
||||
* @param module 所属模块
|
||||
* @param code 错误码
|
||||
* @param args 参数
|
||||
*/
|
||||
public BaseException(String module, String code, Object[] args) {
|
||||
this(module, code, args, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用模块和默认消息构造异常。
|
||||
*
|
||||
* @param module 所属模块
|
||||
* @param defaultMessage 默认消息
|
||||
*/
|
||||
public BaseException(String module, String defaultMessage) {
|
||||
this(module, null, null, defaultMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用错误码和参数构造异常。
|
||||
*
|
||||
* @param code 错误码
|
||||
* @param args 参数
|
||||
*/
|
||||
public BaseException(String code, Object[] args) {
|
||||
this(null, code, args, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用默认消息构造异常。
|
||||
*
|
||||
* @param defaultMessage 默认消息
|
||||
*/
|
||||
public BaseException(String defaultMessage) {
|
||||
this(null, null, null, defaultMessage);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ public interface WorkflowService {
|
||||
* 获取流程变量
|
||||
*
|
||||
* @param instanceId 流程实例id
|
||||
* @return 流程变量详情
|
||||
*/
|
||||
Map<String, Object> instanceVariable(Long instanceId);
|
||||
|
||||
@@ -65,7 +66,7 @@ public interface WorkflowService {
|
||||
* 启动流程
|
||||
*
|
||||
* @param startProcess 参数
|
||||
* @return 结果
|
||||
* @return 启动后的流程实例与首任务信息
|
||||
*/
|
||||
StartProcessReturnDTO startWorkFlow(StartProcessDTO startProcess);
|
||||
|
||||
@@ -75,7 +76,7 @@ public interface WorkflowService {
|
||||
* completeTask.getVariables().put("ignore", true);
|
||||
*
|
||||
* @param completeTask 参数
|
||||
* @return 结果
|
||||
* @return 办理成功返回 {@code true}
|
||||
*/
|
||||
boolean completeTask(CompleteTaskDTO completeTask);
|
||||
|
||||
@@ -84,7 +85,7 @@ public interface WorkflowService {
|
||||
*
|
||||
* @param taskId 任务ID
|
||||
* @param message 办理意见
|
||||
* @return 结果
|
||||
* @return 办理成功返回 {@code true}
|
||||
*/
|
||||
boolean completeTask(Long taskId, String message);
|
||||
|
||||
@@ -92,7 +93,7 @@ public interface WorkflowService {
|
||||
* 启动流程并办理第一个任务
|
||||
*
|
||||
* @param startProcess 参数
|
||||
* @return 结果
|
||||
* @return 首节点办理成功返回 {@code true}
|
||||
*/
|
||||
boolean startCompleteTask(StartProcessDTO startProcess);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user