Compare commits
12 Commits
14f9193703
...
future/6.X
| Author | SHA1 | Date | |
|---|---|---|---|
| bb68d9e227 | |||
| b177620e66 | |||
| bd57356912 | |||
| d50631575a | |||
| 0cab98bc8a | |||
| 415a72b7c6 | |||
| 4498b9c9d5 | |||
| 0b37392a8f | |||
| fc43e368b7 | |||
| e38e99b7f8 | |||
| 83eb74c56d | |||
| a87dcea74b |
@@ -14,22 +14,22 @@
|
||||
|
||||
<properties>
|
||||
<revision>5.5.3</revision>
|
||||
<spring-boot.version>4.0.6</spring-boot.version>
|
||||
<spring-boot.version>4.1.0</spring-boot.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>21</java.version>
|
||||
<mybatis.version>3.5.19</mybatis.version>
|
||||
<springdoc.version>3.0.2</springdoc.version>
|
||||
<springdoc.version>3.0.3</springdoc.version>
|
||||
<therapi-javadoc.version>0.15.0</therapi-javadoc.version>
|
||||
<fesod.version>2.0.1-incubating</fesod.version>
|
||||
<fesod.version>2.0.2-incubating</fesod.version>
|
||||
<velocity.version>2.4.1</velocity.version>
|
||||
<satoken.version>1.45.0</satoken.version>
|
||||
<mybatis-plus.version>3.5.16</mybatis-plus.version>
|
||||
<mybatis-plus-join.version>1.5.6</mybatis-plus-join.version>
|
||||
<p6spy.version>3.9.1</p6spy.version>
|
||||
<hutool.version>5.8.44</hutool.version>
|
||||
<hutool.version>5.8.46</hutool.version>
|
||||
<spring-boot-admin.version>4.0.4</spring-boot-admin.version>
|
||||
<redisson.version>4.4.0</redisson.version>
|
||||
<redisson.version>4.5.0</redisson.version>
|
||||
<lock4j.version>2.2.7</lock4j.version>
|
||||
<dynamic-ds.version>4.5.0</dynamic-ds.version>
|
||||
<snailjob.version>2.0.0</snailjob.version>
|
||||
@@ -37,7 +37,7 @@
|
||||
<mapstruct-plus.version>1.5.0</mapstruct-plus.version>
|
||||
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
|
||||
<lombok.version>1.18.42</lombok.version>
|
||||
<bouncycastle.version>1.83</bouncycastle.version>
|
||||
<bouncycastle.version>1.84</bouncycastle.version>
|
||||
<justauth.version>1.16.7</justauth.version>
|
||||
<!-- 离线IP地址定位库 -->
|
||||
<ip2region.version>3.3.6</ip2region.version>
|
||||
@@ -52,7 +52,7 @@
|
||||
<!-- 工作流配置 -->
|
||||
<warm-flow.version>1.8.7</warm-flow.version>
|
||||
<!-- mqtt客户端 -->
|
||||
<mica-mqtt.version>2.5.12</mica-mqtt.version>
|
||||
<mica-mqtt.version>2.6.5</mica-mqtt.version>
|
||||
<easy-es.version>3.0.2</easy-es.version>
|
||||
<elasticsearch-client.version>7.17.28</elasticsearch-client.version>
|
||||
<!-- Spring AI 2.0 预览版,正式版发布后仅需调整此版本号 -->
|
||||
@@ -66,7 +66,7 @@
|
||||
<!-- 统一版本号管理:Maven3.X需要,Maven4.0之后已原生支持 -->
|
||||
<flatten-maven-plugin.version>1.7.3</flatten-maven-plugin.version>
|
||||
<!-- 打包默认跳过测试 -->
|
||||
<skipTests>true</skipTests>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
|
||||
@@ -11,18 +11,20 @@ RUN mkdir -p /ruoyi/server/logs \
|
||||
|
||||
WORKDIR /ruoyi/server
|
||||
|
||||
ENV SERVER_PORT=8080 SNAIL_PORT=28080 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
ENV SERVER_PORT=8080 SNAIL_JOB_PORT=28080 SNAIL_AI_PORT=38080 LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS=""
|
||||
|
||||
EXPOSE ${SERVER_PORT}
|
||||
# 暴露 snail job 客户端端口 用于定时任务调度中心通信
|
||||
EXPOSE ${SNAIL_PORT}
|
||||
# 暴露 snail 客户端端口 用于定时任务调度中心通信
|
||||
EXPOSE ${SNAIL_JOB_PORT}
|
||||
EXPOSE ${SNAIL_AI_PORT}
|
||||
|
||||
ADD ./target/ruoyi-admin.jar ./app.jar
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom -Dserver.port=${SERVER_PORT} \
|
||||
-Dsnail-job.port=${SNAIL_PORT} \
|
||||
-Dsnail-job.port=${SNAIL_JOB_PORT} \
|
||||
-Dsnail-ai.port=${SNAIL_AI_PORT} \
|
||||
# 应用名称 如果想区分集群节点监控 改成不同的名称即可
|
||||
#-Dskywalking.agent.service_name=ruoyi-server \
|
||||
#-javaagent:/ruoyi/skywalking/agent/skywalking-agent.jar \
|
||||
|
||||
@@ -97,7 +97,7 @@ public class SysLoginService {
|
||||
sysSocialService.insertByBo(bo);
|
||||
} else {
|
||||
// 更新用户信息
|
||||
bo.setId(list.get(0).getId());
|
||||
bo.setId(list.getFirst().getId());
|
||||
sysSocialService.updateByBo(bo);
|
||||
// 如果要绑定的平台账号已经被绑定过了 是否抛异常自行决断
|
||||
// throw new ServiceException("此平台账号已经被绑定!");
|
||||
|
||||
@@ -68,7 +68,7 @@ public class SocialAuthStrategy implements IAuthStrategy {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
throw new ServiceException("你还没有绑定第三方账号,绑定后才可以登录!");
|
||||
}
|
||||
SysUserVo user = loadUser(list.get(0).getUserId());
|
||||
SysUserVo user = loadUser(list.getFirst().getUserId());
|
||||
// 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了
|
||||
LoginUser loginUser = loginService.buildLoginUser(user);
|
||||
loginUser.setClientKey(client.getClientKey());
|
||||
|
||||
@@ -137,7 +137,7 @@ spring.data:
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# redis 密码必须配置
|
||||
password: ruoyi123
|
||||
# password: ruoyi123
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
|
||||
@@ -263,8 +263,8 @@ mqtt.client:
|
||||
timeout: 5
|
||||
# 重连时间,默认 5000 毫秒
|
||||
re-interval: 5000
|
||||
# mqtt 协议版本,可选 MQTT_3_1、mqtt_3_1_1、mqtt_5,默认:mqtt_3_1_1
|
||||
version: mqtt_3_1_1
|
||||
# mqtt 协议版本,可选 MQTT_3_1、mqtt_3_1_1、mqtt_5,默认:mqtt_5
|
||||
version: mqtt_5
|
||||
# 接收数据的 buffer size,默认:8k
|
||||
read-buffer-size: 8KB
|
||||
# 消息解析最大 bytes 长度,默认:10M
|
||||
|
||||
+1
-2
@@ -98,9 +98,8 @@ public class ThreadPoolConfig {
|
||||
* @param t 任务执行过程中抛出的异常
|
||||
*/
|
||||
public static void printException(Runnable r, Throwable t) {
|
||||
if (t == null && r instanceof Future<?>) {
|
||||
if (t == null && r instanceof Future<?> future) {
|
||||
try {
|
||||
Future<?> future = (Future<?>) r;
|
||||
if (future.isDone()) {
|
||||
future.get();
|
||||
}
|
||||
|
||||
-152
@@ -1,152 +0,0 @@
|
||||
package org.dromara.common.core.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
|
||||
/*
|
||||
* 日期格式
|
||||
* "yyyy":4位数的年份,例如:2023年表示为"2023"。
|
||||
* "yy":2位数的年份,例如:2023年表示为"23"。
|
||||
* "MM":2位数的月份,取值范围为01到12,例如:7月表示为"07"。
|
||||
* "M":不带前导零的月份,取值范围为1到12,例如:7月表示为"7"。
|
||||
* "dd":2位数的日期,取值范围为01到31,例如:22日表示为"22"。
|
||||
* "d":不带前导零的日期,取值范围为1到31,例如:22日表示为"22"。
|
||||
* "EEEE":星期的全名,例如:星期三表示为"Wednesday"。
|
||||
* "E":星期的缩写,例如:星期三表示为"Wed"。
|
||||
* "DDD" 或 "D":一年中的第几天,取值范围为001到366,例如:第200天表示为"200"。
|
||||
* 时间格式
|
||||
* "HH":24小时制的小时数,取值范围为00到23,例如:下午5点表示为"17"。
|
||||
* "hh":12小时制的小时数,取值范围为01到12,例如:下午5点表示为"05"。
|
||||
* "mm":分钟数,取值范围为00到59,例如:30分钟表示为"30"。
|
||||
* "ss":秒数,取值范围为00到59,例如:45秒表示为"45"。
|
||||
* "SSS":毫秒数,取值范围为000到999,例如:123毫秒表示为"123"。
|
||||
*/
|
||||
|
||||
/**
|
||||
* 日期格式与时间格式枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FormatsType {
|
||||
|
||||
/**
|
||||
* 例如:2023年表示为"23"
|
||||
*/
|
||||
YY("yy"),
|
||||
|
||||
/**
|
||||
* 例如:2023年表示为"2023"
|
||||
*/
|
||||
YYYY("yyyy"),
|
||||
|
||||
/**
|
||||
* 例例如,2023年7月可以表示为 "2023-07"
|
||||
*/
|
||||
YYYY_MM("yyyy-MM"),
|
||||
|
||||
/**
|
||||
* 例如,日期 "2023年7月22日" 可以表示为 "2023-07-22"
|
||||
*/
|
||||
YYYY_MM_DD("yyyy-MM-dd"),
|
||||
|
||||
/**
|
||||
* 例如,当前时间如果是 "2023年7月22日下午3点30分",则可以表示为 "2023-07-22 15:30"
|
||||
*/
|
||||
YYYY_MM_DD_HH_MM("yyyy-MM-dd HH:mm"),
|
||||
|
||||
/**
|
||||
* 例如,当前时间如果是 "2023年7月22日下午3点30分45秒",则可以表示为 "2023-07-22 15:30:45"
|
||||
*/
|
||||
YYYY_MM_DD_HH_MM_SS("yyyy-MM-dd HH:mm:ss"),
|
||||
|
||||
/**
|
||||
* 例如:下午3点30分45秒,表示为 "15:30:45"
|
||||
*/
|
||||
HH_MM_SS("HH:mm:ss"),
|
||||
|
||||
/**
|
||||
* 例例如,2023年7月可以表示为 "2023/07"
|
||||
*/
|
||||
YYYY_MM_SLASH("yyyy/MM"),
|
||||
|
||||
/**
|
||||
* 例如,日期 "2023年7月22日" 可以表示为 "2023/07/22"
|
||||
*/
|
||||
YYYY_MM_DD_SLASH("yyyy/MM/dd"),
|
||||
|
||||
/**
|
||||
* 例如,当前时间如果是 "2023年7月22日下午3点30分45秒",则可以表示为 "2023/07/22 15:30:45"
|
||||
*/
|
||||
YYYY_MM_DD_HH_MM_SLASH("yyyy/MM/dd HH:mm"),
|
||||
|
||||
/**
|
||||
* 例如,当前时间如果是 "2023年7月22日下午3点30分45秒",则可以表示为 "2023/07/22 15:30:45"
|
||||
*/
|
||||
YYYY_MM_DD_HH_MM_SS_SLASH("yyyy/MM/dd HH:mm:ss"),
|
||||
|
||||
/**
|
||||
* 例例如,2023年7月可以表示为 "2023.07"
|
||||
*/
|
||||
YYYY_MM_DOT("yyyy.MM"),
|
||||
|
||||
/**
|
||||
* 例如,日期 "2023年7月22日" 可以表示为 "2023.07.22"
|
||||
*/
|
||||
YYYY_MM_DD_DOT("yyyy.MM.dd"),
|
||||
|
||||
/**
|
||||
* 例如,当前时间如果是 "2023年7月22日下午3点30分",则可以表示为 "2023.07.22 15:30"
|
||||
*/
|
||||
YYYY_MM_DD_HH_MM_DOT("yyyy.MM.dd HH:mm"),
|
||||
|
||||
/**
|
||||
* 例如,当前时间如果是 "2023年7月22日下午3点30分45秒",则可以表示为 "2023.07.22 15:30:45"
|
||||
*/
|
||||
YYYY_MM_DD_HH_MM_SS_DOT("yyyy.MM.dd HH:mm:ss"),
|
||||
|
||||
/**
|
||||
* 例如,2023年7月可以表示为 "202307"
|
||||
*/
|
||||
YYYYMM("yyyyMM"),
|
||||
|
||||
/**
|
||||
* 例如,2023年7月22日可以表示为 "20230722"
|
||||
*/
|
||||
YYYYMMDD("yyyyMMdd"),
|
||||
|
||||
/**
|
||||
* 例如,2023年7月22日下午3点可以表示为 "2023072215"
|
||||
*/
|
||||
YYYYMMDDHH("yyyyMMddHH"),
|
||||
|
||||
/**
|
||||
* 例如,2023年7月22日下午3点30分可以表示为 "202307221530"
|
||||
*/
|
||||
YYYYMMDDHHMM("yyyyMMddHHmm"),
|
||||
|
||||
/**
|
||||
* 例如,2023年7月22日下午3点30分45秒可以表示为 "20230722153045"
|
||||
*/
|
||||
YYYYMMDDHHMMSS("yyyyMMddHHmmss");
|
||||
|
||||
/**
|
||||
* 时间格式
|
||||
*/
|
||||
private final String timeFormat;
|
||||
|
||||
/**
|
||||
* 根据字符串内容匹配时间格式类型。
|
||||
*
|
||||
* @param str 字符串内容
|
||||
* @return 时间格式类型
|
||||
*/
|
||||
public static FormatsType getFormatsType(String str) {
|
||||
for (FormatsType value : values()) {
|
||||
if (StringUtils.contains(str, value.getTimeFormat())) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("'FormatsType' not found By " + str);
|
||||
}
|
||||
}
|
||||
+65
-314
@@ -1,344 +1,96 @@
|
||||
package org.dromara.common.core.utils;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.BetweenFormatter;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.dromara.common.core.enums.FormatsType;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 时间工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author AprilWind
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
/**
|
||||
* 日期解析格式集合。
|
||||
*/
|
||||
private static final String[] PARSE_PATTERNS = {
|
||||
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
|
||||
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
|
||||
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"
|
||||
};
|
||||
public class DateUtils extends DateUtil {
|
||||
|
||||
/**
|
||||
* 获取当前日期和时间
|
||||
* 计算时间差并格式化(精确到秒)
|
||||
*
|
||||
* @return 当前日期和时间的 Date 对象表示
|
||||
* @param start 开始时间(支持 Date/LocalDateTime)
|
||||
* @param end 结束时间(支持 Date/LocalDateTime)
|
||||
* @return 时分秒格式时间差
|
||||
*/
|
||||
public static Date getNowDate() {
|
||||
return new Date();
|
||||
public static String formatBetweenBySecond(Object start, Object end) {
|
||||
return formatTimeBetween(start, end, BetweenFormatter.Level.SECOND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期的字符串表示,格式为YYYY-MM-DD
|
||||
*
|
||||
* @return 当前日期的字符串表示
|
||||
*/
|
||||
public static String getDate() {
|
||||
return dateTimeNow(FormatsType.YYYY_MM_DD);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期的字符串表示,格式为yyyyMMdd
|
||||
*
|
||||
* @return 当前日期的字符串表示
|
||||
*/
|
||||
public static String getCurrentDate() {
|
||||
return DateFormatUtils.format(new Date(), FormatsType.YYYYMMDD.getTimeFormat());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期的路径格式字符串,格式为"yyyy/MM/dd"
|
||||
*
|
||||
* @return 当前日期的路径格式字符串
|
||||
*/
|
||||
public static String datePath() {
|
||||
Date now = new Date();
|
||||
return DateFormatUtils.format(now, FormatsType.YYYY_MM_DD_SLASH.getTimeFormat());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间的字符串表示,格式为YYYY-MM-DD HH:MM:SS
|
||||
*
|
||||
* @return 当前时间的字符串表示
|
||||
*/
|
||||
public static String getTime() {
|
||||
return dateTimeNow(FormatsType.YYYY_MM_DD_HH_MM_SS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间的字符串表示,格式为 "HH:MM:SS"
|
||||
*
|
||||
* @return 当前时间的字符串表示,格式为 "HH:MM:SS"
|
||||
*/
|
||||
public static String getTimeWithHourMinuteSecond() {
|
||||
return dateTimeNow(FormatsType.HH_MM_SS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期和时间的字符串表示,格式为YYYYMMDDHHMMSS
|
||||
*
|
||||
* @return 当前日期和时间的字符串表示
|
||||
*/
|
||||
public static String dateTimeNow() {
|
||||
return dateTimeNow(FormatsType.YYYYMMDDHHMMSS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期和时间的指定格式的字符串表示
|
||||
*
|
||||
* @param format 日期时间格式,例如"YYYY-MM-DD HH:MM:SS"
|
||||
* @return 当前日期和时间的字符串表示
|
||||
*/
|
||||
public static String dateTimeNow(final FormatsType format) {
|
||||
return parseDateToStr(format, new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将指定日期格式化为 YYYY-MM-DD 格式的字符串
|
||||
*
|
||||
* @param date 要格式化的日期对象
|
||||
* @return 格式化后的日期字符串
|
||||
*/
|
||||
public static String formatDate(final Date date) {
|
||||
return parseDateToStr(FormatsType.YYYY_MM_DD, date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将指定日期格式化为 YYYY-MM-DD HH:MM:SS 格式的字符串
|
||||
*
|
||||
* @param date 要格式化的日期对象
|
||||
* @return 格式化后的日期时间字符串
|
||||
*/
|
||||
public static String formatDateTime(final Date date) {
|
||||
return parseDateToStr(FormatsType.YYYY_MM_DD_HH_MM_SS, date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 LocalDateTime 格式化为 YYYY-MM-DD HH:MM:SS 格式的字符串
|
||||
*
|
||||
* @param dateTime 要格式化的 LocalDateTime 对象
|
||||
* @return 格式化后的日期时间字符串
|
||||
*/
|
||||
public static String formatDateTime(final LocalDateTime dateTime) {
|
||||
return dateTime.format(DateTimeFormatter.ofPattern(FormatsType.YYYY_MM_DD_HH_MM_SS.getTimeFormat()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将指定日期按照指定格式进行格式化
|
||||
*
|
||||
* @param format 要使用的日期时间格式,例如"YYYY-MM-DD HH:MM:SS"
|
||||
* @param date 要格式化的日期对象
|
||||
* @return 格式化后的日期时间字符串
|
||||
*/
|
||||
public static String parseDateToStr(final FormatsType format, final Date date) {
|
||||
return new SimpleDateFormat(format.getTimeFormat()).format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将指定格式的日期时间字符串转换为 Date 对象
|
||||
*
|
||||
* @param format 要解析的日期时间格式,例如"YYYY-MM-DD HH:MM:SS"
|
||||
* @param ts 要解析的日期时间字符串
|
||||
* @return 解析后的 Date 对象
|
||||
* @throws RuntimeException 如果解析过程中发生异常
|
||||
*/
|
||||
public static Date parseDateTime(final FormatsType format, final String ts) {
|
||||
try {
|
||||
return new SimpleDateFormat(format.getTimeFormat()).parse(ts);
|
||||
} catch (ParseException e) {
|
||||
throw new ServiceException("日期时间解析失败:" + ts, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将对象转换为日期对象
|
||||
*
|
||||
* @param str 要转换的对象,通常是字符串
|
||||
* @return 转换后的日期对象,如果转换失败或输入为null,则返回null
|
||||
*/
|
||||
public static Date parseDate(Object str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return parseDate(str.toString(), PARSE_PATTERNS);
|
||||
} catch (ParseException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取服务器启动时间
|
||||
*
|
||||
* @return 服务器启动时间的 Date 对象表示
|
||||
*/
|
||||
public static Date getServerStartDate() {
|
||||
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
|
||||
return new Date(time);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个时间之间的时间差,并以指定单位返回(绝对值)
|
||||
*
|
||||
* @param start 起始时间
|
||||
* @param end 结束时间
|
||||
* @param unit 所需返回的时间单位(DAYS、HOURS、MINUTES、SECONDS、MILLISECONDS、MICROSECONDS、NANOSECONDS)
|
||||
* @return 时间差的绝对值,以指定单位表示
|
||||
*/
|
||||
public static long difference(Date start, Date end, TimeUnit unit) {
|
||||
// 计算时间差,单位为毫秒,取绝对值避免负数
|
||||
long diffInMillis = Math.abs(end.getTime() - start.getTime());
|
||||
|
||||
// 根据目标单位转换时间差
|
||||
return switch (unit) {
|
||||
case DAYS -> diffInMillis / TimeUnit.DAYS.toMillis(1);
|
||||
case HOURS -> diffInMillis / TimeUnit.HOURS.toMillis(1);
|
||||
case MINUTES -> diffInMillis / TimeUnit.MINUTES.toMillis(1);
|
||||
case SECONDS -> diffInMillis / TimeUnit.SECONDS.toMillis(1);
|
||||
case MILLISECONDS -> diffInMillis;
|
||||
case MICROSECONDS -> TimeUnit.MILLISECONDS.toMicros(diffInMillis);
|
||||
case NANOSECONDS -> TimeUnit.MILLISECONDS.toNanos(diffInMillis);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个日期之间的时间差,并以天、小时和分钟的格式返回
|
||||
*
|
||||
* @param endDate 结束日期
|
||||
* @param nowDate 当前日期
|
||||
* @return 表示时间差的字符串,格式为"天 小时 分钟"
|
||||
*/
|
||||
public static String getDatePoor(Date endDate, Date nowDate) {
|
||||
long diffInMillis = endDate.getTime() - nowDate.getTime();
|
||||
long day = TimeUnit.MILLISECONDS.toDays(diffInMillis);
|
||||
long hour = TimeUnit.MILLISECONDS.toHours(diffInMillis) % 24;
|
||||
long min = TimeUnit.MILLISECONDS.toMinutes(diffInMillis) % 60;
|
||||
return String.format("%d天 %d小时 %d分钟", day, hour, min);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个时间点的差值(天、小时、分钟、秒),当值为0时不显示该单位
|
||||
* 通用时间差格式化
|
||||
*
|
||||
* @param startDate 开始时间
|
||||
* @param endDate 结束时间
|
||||
* @param nowDate 当前时间
|
||||
* @return 时间差字符串,格式为 "x天 x小时 x分钟 x秒",若为 0 则不显示
|
||||
* @param level 精度级别
|
||||
* @return 格式化时长
|
||||
*/
|
||||
public static String getTimeDifference(Date endDate, Date nowDate) {
|
||||
long diffInMillis = endDate.getTime() - nowDate.getTime();
|
||||
long day = TimeUnit.MILLISECONDS.toDays(diffInMillis);
|
||||
long hour = TimeUnit.MILLISECONDS.toHours(diffInMillis) % 24;
|
||||
long min = TimeUnit.MILLISECONDS.toMinutes(diffInMillis) % 60;
|
||||
long sec = TimeUnit.MILLISECONDS.toSeconds(diffInMillis) % 60;
|
||||
// 构建时间差字符串,条件是值不为0才显示
|
||||
StringBuilder result = new StringBuilder();
|
||||
if (day > 0) {
|
||||
result.append(String.format("%d天 ", day));
|
||||
}
|
||||
if (hour > 0) {
|
||||
result.append(String.format("%d小时 ", hour));
|
||||
}
|
||||
if (min > 0) {
|
||||
result.append(String.format("%d分钟 ", min));
|
||||
}
|
||||
if (sec > 0) {
|
||||
result.append(String.format("%d秒", sec));
|
||||
}
|
||||
return !result.isEmpty() ? result.toString().trim() : "0秒";
|
||||
public static String formatTimeBetween(Object startDate, Object endDate, BetweenFormatter.Level level) {
|
||||
// 非空校验
|
||||
Assert.notNull(startDate, "开始时间不能为空");
|
||||
Assert.notNull(endDate, "结束时间不能为空");
|
||||
Assert.notNull(level, "时间精度级别不能为空");
|
||||
|
||||
// 统一转为Date并校验格式合法性
|
||||
Date start = Convert.toDate(startDate);
|
||||
Date end = Convert.toDate(endDate);
|
||||
Assert.notNull(start, "开始时间格式错误,无法解析为时间");
|
||||
Assert.notNull(end, "结束时间格式错误,无法解析为时间");
|
||||
|
||||
long diffMillis = Math.abs(end.getTime() - start.getTime());
|
||||
return formatBetween(diffMillis, level);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个 LocalDateTime 时间点的差值(天、小时、分钟、秒),当值为0时不显示该单位
|
||||
*
|
||||
* @param endDate 结束时间
|
||||
* @param nowDate 当前时间
|
||||
* @return 时间差字符串,格式为 "x天 x小时 x分钟 x秒",若为 0 则不显示
|
||||
*/
|
||||
public static String getTimeDifference(LocalDateTime endDate, LocalDateTime nowDate) {
|
||||
long diffInMillis = java.time.Duration.between(nowDate, endDate).toMillis();
|
||||
long day = TimeUnit.MILLISECONDS.toDays(diffInMillis);
|
||||
long hour = TimeUnit.MILLISECONDS.toHours(diffInMillis) % 24;
|
||||
long min = TimeUnit.MILLISECONDS.toMinutes(diffInMillis) % 60;
|
||||
long sec = TimeUnit.MILLISECONDS.toSeconds(diffInMillis) % 60;
|
||||
StringBuilder result = new StringBuilder();
|
||||
if (day > 0) {
|
||||
result.append(String.format("%d天 ", day));
|
||||
}
|
||||
if (hour > 0) {
|
||||
result.append(String.format("%d小时 ", hour));
|
||||
}
|
||||
if (min > 0) {
|
||||
result.append(String.format("%d分钟 ", min));
|
||||
}
|
||||
if (sec > 0) {
|
||||
result.append(String.format("%d秒", sec));
|
||||
}
|
||||
return !result.isEmpty() ? result.toString().trim() : "0秒";
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 LocalDateTime 对象转换为 Date 对象
|
||||
*
|
||||
* @param temporalAccessor 要转换的 LocalDateTime 对象
|
||||
* @return 转换后的 Date 对象
|
||||
*/
|
||||
public static Date toDate(LocalDateTime temporalAccessor) {
|
||||
ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 LocalDate 对象转换为 Date 对象
|
||||
*
|
||||
* @param temporalAccessor 要转换的 LocalDate 对象
|
||||
* @return 转换后的 Date 对象
|
||||
*/
|
||||
public static Date toDate(LocalDate temporalAccessor) {
|
||||
LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
|
||||
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验日期范围
|
||||
* 校验日期范围及最大时间跨度
|
||||
*
|
||||
* @param startDate 开始日期
|
||||
* @param endDate 结束日期
|
||||
* @param maxValue 最大时间跨度的限制值
|
||||
* @param unit 时间跨度的单位,可选择 "DAYS"、"HOURS" 或 "MINUTES"
|
||||
* @param maxValue 最大时间跨度限制值
|
||||
* @param unit 时间单位
|
||||
*/
|
||||
public static void validateDateRange(Date startDate, Date endDate, int maxValue, TimeUnit unit) {
|
||||
// 校验结束日期不能早于开始日期
|
||||
if (endDate.before(startDate)) {
|
||||
public static void validateDateRange(Object startDate, Object endDate, int maxValue, TimeUnit unit) {
|
||||
// 基础非空校验
|
||||
Assert.notNull(startDate, "开始日期不能为空");
|
||||
Assert.notNull(endDate, "结束日期不能为空");
|
||||
Assert.notNull(unit, "时间单位不能为空");
|
||||
|
||||
// 统一转换并校验时间合法性
|
||||
Date start = Convert.toDate(startDate);
|
||||
Date end = Convert.toDate(endDate);
|
||||
Assert.notNull(start, "开始日期格式错误,无法解析为时间");
|
||||
Assert.notNull(end, "结束日期格式错误,无法解析为时间");
|
||||
|
||||
// 校验结束时间不能早于开始时间
|
||||
if (end.before(start)) {
|
||||
throw new ServiceException("结束日期不能早于开始日期");
|
||||
}
|
||||
|
||||
// 计算时间跨度
|
||||
long diffInMillis = endDate.getTime() - startDate.getTime();
|
||||
|
||||
// 根据单位转换时间跨度
|
||||
long diffMillis = end.getTime() - start.getTime();
|
||||
long diff = switch (unit) {
|
||||
case DAYS -> TimeUnit.MILLISECONDS.toDays(diffInMillis);
|
||||
case HOURS -> TimeUnit.MILLISECONDS.toHours(diffInMillis);
|
||||
case MINUTES -> TimeUnit.MILLISECONDS.toMinutes(diffInMillis);
|
||||
default -> throw new IllegalArgumentException("不支持的时间单位");
|
||||
case DAYS -> TimeUnit.MILLISECONDS.toDays(diffMillis);
|
||||
case HOURS -> TimeUnit.MILLISECONDS.toHours(diffMillis);
|
||||
case MINUTES -> TimeUnit.MILLISECONDS.toMinutes(diffMillis);
|
||||
default -> throw new IllegalArgumentException("不支持的时间单位:" + unit.name());
|
||||
};
|
||||
|
||||
// 校验时间跨度不超过最大限制
|
||||
if (diff > maxValue) {
|
||||
throw new ServiceException("最大时间跨度为 {} {}", maxValue, unit.toString().toLowerCase());
|
||||
String msg = String.format("最大时间跨度为 %d %s", maxValue, unit.name().toLowerCase());
|
||||
throw new ServiceException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +101,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
* @return 时间段描述
|
||||
*/
|
||||
public static String getTodayHour(Date date) {
|
||||
int hour = DateUtil.hour(date, true);
|
||||
int hour = hour(date, true);
|
||||
if (hour <= 6) {
|
||||
return "凌晨";
|
||||
} else if (hour < 12) {
|
||||
@@ -384,38 +136,37 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
if (date == null) {
|
||||
return "";
|
||||
}
|
||||
Date now = DateUtil.date();
|
||||
Date now = new Date();
|
||||
|
||||
// 未来时间或非今年
|
||||
if (date.after(now) || DateUtil.year(date) != DateUtil.year(now)) {
|
||||
return parseDateToStr(FormatsType.YYYY_MM_DD_HH_MM, date);
|
||||
if (date.after(now) || year(date) != year(now)) {
|
||||
return formatDateTime(now);
|
||||
}
|
||||
|
||||
// 今天
|
||||
if (DateUtil.isSameDay(date, now)) {
|
||||
long minutes = DateUtil.between(date, now, DateUnit.MINUTE);
|
||||
if (isSameDay(date, now)) {
|
||||
long minutes = between(date, now, DateUnit.MINUTE);
|
||||
if (minutes < 1) {
|
||||
return "刚刚";
|
||||
}
|
||||
if (minutes < 60) {
|
||||
return minutes + "分钟前";
|
||||
}
|
||||
return getTodayHour(date) + " " + DateUtil.format(date, "HH:mm");
|
||||
return getTodayHour(date) + " " + format(date, "HH:mm");
|
||||
}
|
||||
|
||||
// 昨天
|
||||
if (DateUtil.isSameDay(date, DateUtil.yesterday())) {
|
||||
return "昨天 " + DateUtil.format(date, "HH:mm");
|
||||
if (isSameDay(date, yesterday())) {
|
||||
return "昨天 " + format(date, "HH:mm");
|
||||
}
|
||||
|
||||
// 本周
|
||||
if (DateUtil.isSameWeek(date, now, true)) {
|
||||
return DateUtil.dayOfWeekEnum(date).toChinese("周")
|
||||
+ " " + DateUtil.format(date, "HH:mm");
|
||||
if (isSameWeek(date, now, true)) {
|
||||
return dayOfWeekEnum(date).toChinese("周") + " " + format(date, "HH:mm");
|
||||
}
|
||||
|
||||
// 今年内其它时间
|
||||
return DateUtil.format(date, "MM-dd HH:mm");
|
||||
return format(date, "MM-dd HH:mm");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class TreeBuildUtils extends TreeUtil {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
K k = ReflectUtils.invokeGetter(list.get(0), "parentId");
|
||||
K k = ReflectUtils.invokeGetter(list.getFirst(), "parentId");
|
||||
return TreeUtil.build(list, k, DEFAULT_CONFIG, nodeParser);
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -12,7 +12,6 @@ import java.lang.reflect.Method;
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public class ReflectUtils extends ReflectUtil {
|
||||
|
||||
|
||||
+1
-1
@@ -21,6 +21,6 @@ public enum EncodeType {
|
||||
/**
|
||||
* 16进制编码
|
||||
*/
|
||||
HEX;
|
||||
HEX
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public class CellMergeHandler {
|
||||
}
|
||||
|
||||
// 获取有合并注解的字段
|
||||
Map<Field, FieldColumnIndex> mergeFields = getFieldColumnIndexMap(rows.get(0).getClass());
|
||||
Map<Field, FieldColumnIndex> mergeFields = getFieldColumnIndexMap(rows.getFirst().getClass());
|
||||
// 如果没有需要合并的字段则返回空集
|
||||
if (CollUtil.isEmpty(mergeFields)) {
|
||||
return Collections.emptyList();
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ public class DropDownOptions {
|
||||
sonList.forEach(everySon -> {
|
||||
if (parentGroupByIdMap.containsKey(sonHowToGetParentIdFunction.apply(everySon))) {
|
||||
// 找到对应的上级
|
||||
T parentObj = parentGroupByIdMap.get(sonHowToGetParentIdFunction.apply(everySon)).get(0);
|
||||
T parentObj = parentGroupByIdMap.get(sonHowToGetParentIdFunction.apply(everySon)).getFirst();
|
||||
// 提取名称和ID作为Key
|
||||
String key = howToBuildEveryOption.apply(parentObj);
|
||||
// Key对应的Value
|
||||
|
||||
+2
-2
@@ -282,10 +282,10 @@ public class ExcelDownHandler implements SheetWriteHandler {
|
||||
continue;
|
||||
}
|
||||
// 取第一个
|
||||
String str = data.get(0);
|
||||
String str = data.getFirst();
|
||||
rowData.add(str);
|
||||
// 通过移除的方式避免重复
|
||||
data.remove(0);
|
||||
data.removeFirst();
|
||||
// 设置可以继续
|
||||
flag = true;
|
||||
}
|
||||
|
||||
+7
-3
@@ -109,17 +109,21 @@ public class JsonValueEnhancer {
|
||||
* @param visited 已访问对象集合,用于避免循环引用
|
||||
*/
|
||||
private void collectValue(Object value, JsonEnhancementContext context, IdentityHashMap<Object, Boolean> visited) {
|
||||
if (value == null) {
|
||||
switch (value) {
|
||||
case null -> {
|
||||
return;
|
||||
}
|
||||
if (value instanceof Map<?, ?> map) {
|
||||
case Map<?, ?> map -> {
|
||||
map.values().forEach(child -> collectValue(child, context, visited));
|
||||
return;
|
||||
}
|
||||
if (value instanceof Iterable<?> iterable) {
|
||||
case Iterable<?> iterable -> {
|
||||
iterable.forEach(child -> collectValue(child, context, visited));
|
||||
return;
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
if (value.getClass().isArray()) {
|
||||
int length = Array.getLength(value);
|
||||
for (int i = 0; i < length; i++) {
|
||||
|
||||
+3
-3
@@ -1,5 +1,8 @@
|
||||
package org.dromara.common.mqtt.config;
|
||||
|
||||
import net.dreamlu.mica.net.utils.thread.ThreadUtils;
|
||||
import net.dreamlu.mica.net.utils.thread.pool.SynThreadPoolExecutor;
|
||||
import net.dreamlu.mica.net.utils.thread.pool.TioCallerRunsPolicy;
|
||||
import org.dromara.common.mqtt.listener.MqttClientConnectListener;
|
||||
import org.dromara.common.mqtt.listener.MqttClientGlobalMessageListener;
|
||||
import org.dromara.mica.mqtt.core.client.MqttClientCreator;
|
||||
@@ -8,9 +11,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.task.VirtualThreadTaskExecutor;
|
||||
import org.tio.utils.thread.ThreadUtils;
|
||||
import org.tio.utils.thread.pool.SynThreadPoolExecutor;
|
||||
import org.tio.utils.thread.pool.TioCallerRunsPolicy;
|
||||
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
+1
-1
@@ -1,9 +1,9 @@
|
||||
package org.dromara.common.mqtt.listener;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dreamlu.mica.net.core.ChannelContext;
|
||||
import org.dromara.mica.mqtt.core.client.IMqttClientConnectListener;
|
||||
import org.dromara.mica.mqtt.core.client.MqttClientCreator;
|
||||
import org.tio.core.ChannelContext;
|
||||
|
||||
/**
|
||||
* 客户端连接状态监听
|
||||
|
||||
+1
-1
@@ -1,9 +1,9 @@
|
||||
package org.dromara.common.mqtt.listener;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.dreamlu.mica.net.core.ChannelContext;
|
||||
import org.dromara.mica.mqtt.codec.message.MqttPublishMessage;
|
||||
import org.dromara.mica.mqtt.core.client.IMqttClientGlobalMessageListener;
|
||||
import org.tio.core.ChannelContext;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
||||
+2
@@ -122,6 +122,7 @@ public class LambdaCrudChainWrapper<T, V> extends AbstractLambdaWrapper<T, Lambd
|
||||
* @param columns 查询字段
|
||||
* @return this
|
||||
*/
|
||||
@Override
|
||||
@SafeVarargs
|
||||
public final LambdaCrudChainWrapper<T, V> select(SFunction<T, ?>... columns) {
|
||||
return select(true, CollectionUtils.toList(columns));
|
||||
@@ -134,6 +135,7 @@ public class LambdaCrudChainWrapper<T, V> extends AbstractLambdaWrapper<T, Lambd
|
||||
* @param columns 查询字段
|
||||
* @return this
|
||||
*/
|
||||
@Override
|
||||
@SafeVarargs
|
||||
public final LambdaCrudChainWrapper<T, V> select(boolean condition, SFunction<T, ?>... columns) {
|
||||
return select(condition, CollectionUtils.toList(columns));
|
||||
|
||||
+19
-3
@@ -400,6 +400,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param value 条件值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> eq(boolean condition, SFunction<T, ?> column, Object value) {
|
||||
wrapper.eq(condition, column, value);
|
||||
return this;
|
||||
@@ -425,6 +426,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param value 条件值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> ne(boolean condition, SFunction<T, ?> column, Object value) {
|
||||
wrapper.ne(condition, column, value);
|
||||
return this;
|
||||
@@ -450,6 +452,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param value 条件值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> gt(boolean condition, SFunction<T, ?> column, Object value) {
|
||||
wrapper.gt(condition, column, value);
|
||||
return this;
|
||||
@@ -475,6 +478,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param value 条件值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> ge(boolean condition, SFunction<T, ?> column, Object value) {
|
||||
wrapper.ge(condition, column, value);
|
||||
return this;
|
||||
@@ -500,6 +504,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param value 条件值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> lt(boolean condition, SFunction<T, ?> column, Object value) {
|
||||
wrapper.lt(condition, column, value);
|
||||
return this;
|
||||
@@ -525,6 +530,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param value 条件值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> le(boolean condition, SFunction<T, ?> column, Object value) {
|
||||
wrapper.le(condition, column, value);
|
||||
return this;
|
||||
@@ -550,6 +556,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param value 条件值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> like(boolean condition, SFunction<T, ?> column, Object value) {
|
||||
wrapper.like(condition, column, value);
|
||||
return this;
|
||||
@@ -575,6 +582,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param value 条件值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> notLike(boolean condition, SFunction<T, ?> column, Object value) {
|
||||
wrapper.notLike(condition, column, value);
|
||||
return this;
|
||||
@@ -600,6 +608,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param value 条件值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> likeLeft(boolean condition, SFunction<T, ?> column, Object value) {
|
||||
wrapper.likeLeft(condition, column, value);
|
||||
return this;
|
||||
@@ -625,6 +634,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param value 条件值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> likeRight(boolean condition, SFunction<T, ?> column, Object value) {
|
||||
wrapper.likeRight(condition, column, value);
|
||||
return this;
|
||||
@@ -652,6 +662,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param end 结束值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> between(boolean condition, SFunction<T, ?> column, Object begin, Object end) {
|
||||
wrapper.between(condition, column, begin, end);
|
||||
return this;
|
||||
@@ -679,6 +690,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param end 结束值
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> notBetween(boolean condition, SFunction<T, ?> column, Object begin, Object end) {
|
||||
wrapper.notBetween(condition, column, begin, end);
|
||||
return this;
|
||||
@@ -718,7 +730,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
public LambdaQueryBuilder<T> allEq(BiPredicate<SFunction<T, ?>, Object> filter, Map<?, ?> params, boolean null2IsNull) {
|
||||
wrapper.allEq(true, (BiPredicate) filter, (Map) params, null2IsNull);
|
||||
wrapper.allEq(true, filter, (Map) params, null2IsNull);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -732,7 +744,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
public LambdaQueryBuilder<T> allEq(boolean condition, BiPredicate<SFunction<T, ?>, Object> filter, Map<?, ?> params, boolean null2IsNull) {
|
||||
wrapper.allEq(condition, (BiPredicate) filter, (Map) params, null2IsNull);
|
||||
wrapper.allEq(condition, filter, (Map) params, null2IsNull);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -802,6 +814,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param values 条件值集合
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> in(boolean condition, SFunction<T, ?> column, Collection<?> values) {
|
||||
wrapper.in(condition, column, values);
|
||||
return this;
|
||||
@@ -827,6 +840,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param values 条件值数组
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> in(boolean condition, SFunction<T, ?> column, Object... values) {
|
||||
wrapper.in(condition, column, values);
|
||||
return this;
|
||||
@@ -852,6 +866,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param values 条件值集合
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> notIn(boolean condition, SFunction<T, ?> column, Collection<?> values) {
|
||||
wrapper.notIn(condition, column, values);
|
||||
return this;
|
||||
@@ -877,6 +892,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param values 条件值数组
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> notIn(boolean condition, SFunction<T, ?> column, Object... values) {
|
||||
wrapper.notIn(condition, column, values);
|
||||
return this;
|
||||
@@ -1219,6 +1235,7 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
* @param values SQL 片段参数
|
||||
* @return 当前查询构造辅助对象
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryBuilder<T> apply(boolean condition, String applySql, Object... values) {
|
||||
wrapper.apply(condition, applySql, values);
|
||||
return this;
|
||||
@@ -1368,7 +1385,6 @@ public final class LambdaQueryBuilder<T> implements LambdaQueryCondition<T, Lamb
|
||||
*
|
||||
* @return 聚合查询包装器
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private AggregateLambdaQueryWrapper<T> aggregateWrapper() {
|
||||
return (AggregateLambdaQueryWrapper<T>) wrapper;
|
||||
}
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ public class PlusDataPermissionHandler {
|
||||
}
|
||||
Object defaultValue = "-1";
|
||||
NullSafeStandardEvaluationContext context = new NullSafeStandardEvaluationContext(defaultValue);
|
||||
context.addPropertyAccessor(new NullSafePropertyAccessor(context.getPropertyAccessors().get(0), defaultValue));
|
||||
context.addPropertyAccessor(new NullSafePropertyAccessor(context.getPropertyAccessors().getFirst(), defaultValue));
|
||||
context.setBeanResolver(beanResolver);
|
||||
DataPermissionHelper.getContext().forEach(context::setVariable);
|
||||
Set<String> conditions = new HashSet<>();
|
||||
|
||||
+2
-5
@@ -35,10 +35,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Duration;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -203,7 +200,7 @@ public abstract class AbstractOssClientImpl implements OssClient {
|
||||
.orElse("");
|
||||
String mergedPrefix = mergePrefix(defaultPrefix, businessPrefix);
|
||||
String suffix = suffix(fileName);
|
||||
String datePath = DateUtils.datePath();
|
||||
String datePath = DateUtils.format(new Date(), "yyyy/MM/dd");
|
||||
String uuid = IdUtil.fastSimpleUUID();
|
||||
String path = mergedPrefix.isEmpty() ? datePath + StringUtils.SLASH + uuid : mergedPrefix + StringUtils.SLASH + datePath + StringUtils.SLASH + uuid;
|
||||
return path + suffix;
|
||||
|
||||
+3
-3
@@ -60,7 +60,7 @@ public record HandleAsyncResult<T>(
|
||||
* @return 异步处理结果
|
||||
*/
|
||||
public static <T> HandleAsyncResult<T> of(T result, Throwable error) {
|
||||
return new HandleAsyncResult<T>(result, error);
|
||||
return new HandleAsyncResult<>(result, error);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ public record HandleAsyncResult<T>(
|
||||
* @return 异步处理结果
|
||||
*/
|
||||
public static <T> HandleAsyncResult<T> success(T result) {
|
||||
return new HandleAsyncResult<T>(result, null);
|
||||
return new HandleAsyncResult<>(result, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,6 +82,6 @@ public record HandleAsyncResult<T>(
|
||||
* @return 异步处理结果
|
||||
*/
|
||||
public static <T> HandleAsyncResult<T> failure(Throwable error) {
|
||||
return new HandleAsyncResult<T>(null, error);
|
||||
return new HandleAsyncResult<>(null, error);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -22,7 +22,7 @@ import java.util.stream.Stream;
|
||||
* @version 3.1.0 新增
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
||||
@SuppressWarnings(value = {"rawtypes"})
|
||||
public class RedisUtils {
|
||||
|
||||
private static final RedissonClient CLIENT = SpringUtils.getBean(RedissonClient.class);
|
||||
@@ -280,9 +280,7 @@ public class RedisUtils {
|
||||
return;
|
||||
}
|
||||
RBatch batch = CLIENT.createBatch();
|
||||
collection.forEach(t -> {
|
||||
batch.getBucket(t.toString()).deleteAsync();
|
||||
});
|
||||
collection.forEach(t -> batch.getBucket(t.toString()).deleteAsync());
|
||||
batch.execute();
|
||||
}
|
||||
|
||||
|
||||
-2
@@ -33,7 +33,6 @@ public class SocialUtils {
|
||||
* @return 授权响应
|
||||
* @throws AuthException 授权异常
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static AuthResponse<AuthUser> loginAuth(String source, String code, String state, SocialProperties socialProperties) throws AuthException {
|
||||
AuthRequest authRequest = getAuthRequest(source, socialProperties);
|
||||
AuthCallback callback = new AuthCallback();
|
||||
@@ -93,4 +92,3 @@ public class SocialUtils {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package org.dromara.common.web.config;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.dromara.common.core.utils.DateUtils;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.json.enhance.JsonValueEnhancer;
|
||||
import org.dromara.common.web.advice.ResponseEnhancementAdvice;
|
||||
@@ -50,14 +50,14 @@ public class ResourcesConfig implements WebMvcConfigurer {
|
||||
public void addFormatters(FormatterRegistry registry) {
|
||||
// 全局日期格式转换配置
|
||||
registry.addConverter(String.class, Date.class, source -> {
|
||||
DateTime parse = DateUtil.parse(source);
|
||||
DateTime parse = DateUtils.parse(source);
|
||||
if (ObjectUtils.isNull(parse)) {
|
||||
return null;
|
||||
}
|
||||
return parse.toJdkDate();
|
||||
});
|
||||
registry.addConverter(String.class, LocalDateTime.class, source -> {
|
||||
DateTime parse = DateUtil.parse(source);
|
||||
DateTime parse = DateUtils.parse(source);
|
||||
if (ObjectUtils.isNull(parse)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+7
-4
@@ -1,6 +1,7 @@
|
||||
package org.dromara.common.web.handler;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@@ -151,8 +152,9 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
public R<Void> handleRuntimeException(RuntimeException e, HttpServletRequest request) {
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',发生未知异常.", requestURI, e);
|
||||
return R.fail("发生未知异常,请联系管理员");
|
||||
String errorId = RandomUtil.randomNumbers(8);
|
||||
log.error("请求地址'{}',发生未知异常, 错误编号: {}", requestURI, errorId, e);
|
||||
return R.fail("发生未知异常,请联系管理员 [错误编号: " + errorId + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,8 +163,9 @@ public class GlobalExceptionHandler {
|
||||
@ExceptionHandler(Exception.class)
|
||||
public R<Void> handleException(Exception e, HttpServletRequest request) {
|
||||
String requestURI = request.getRequestURI();
|
||||
log.error("请求地址'{}',发生系统异常.", requestURI, e);
|
||||
return R.fail("发生系统异常,请联系管理员");
|
||||
String errorId = RandomUtil.randomNumbers(8);
|
||||
log.error("请求地址'{}',发生系统异常, 错误编号: {}", requestURI, errorId, e);
|
||||
return R.fail("发生系统异常,请联系管理员 [错误编号: " + errorId + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -122,7 +122,7 @@ public class ExportExcelServiceImpl implements IExportExcelService {
|
||||
Map<Integer, List<DemoCityData>> groupByIdMap =
|
||||
StreamUtils.groupByKey(cityDataList, DemoCityData::getId);
|
||||
if (groupByIdMap.containsKey(id)) {
|
||||
DemoCityData demoCityData = groupByIdMap.get(id).get(0);
|
||||
DemoCityData demoCityData = groupByIdMap.get(id).getFirst();
|
||||
return DropDownOptions.createOptionValue(demoCityData.getName(), demoCityData.getId());
|
||||
} else {
|
||||
return StringUtils.EMPTY;
|
||||
@@ -216,7 +216,7 @@ public class ExportExcelServiceImpl implements IExportExcelService {
|
||||
|
||||
sonList.forEach(everySon -> {
|
||||
if (parentGroupByIdMap.containsKey(everySon.getPid())) {
|
||||
everySon.setPData(parentGroupByIdMap.get(everySon.getPid()).get(0));
|
||||
everySon.setPData(parentGroupByIdMap.get(everySon.getPid()).getFirst());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ public class GenTableColumn extends BaseEntity {
|
||||
*/
|
||||
public String readConverterExp() {
|
||||
String remarks = StringUtils.substringBetween(this.columnComment, "(", ")");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (StringUtils.isNotEmpty(remarks)) {
|
||||
for (String value : remarks.split(" ")) {
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
|
||||
+5
-4
@@ -603,7 +603,7 @@ public class GenTableServiceImpl implements IGenTableService {
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNull(table.getPkColumn())) {
|
||||
table.setPkColumn(table.getColumns().get(0));
|
||||
table.setPkColumn(table.getColumns().getFirst());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -615,11 +615,13 @@ public class GenTableServiceImpl implements IGenTableService {
|
||||
*/
|
||||
public void setTableFromOptions(GenTable genTable) {
|
||||
Dict paramsObj = JsonUtils.parseMap(genTable.getOptions());
|
||||
if (ObjectUtil.isNotNull(paramsObj)) {
|
||||
if (ObjectUtil.isNull(paramsObj)) {
|
||||
paramsObj = new Dict();
|
||||
}
|
||||
String treeCode = paramsObj.getStr(GenConstants.TREE_CODE);
|
||||
String treeParentCode = paramsObj.getStr(GenConstants.TREE_PARENT_CODE);
|
||||
String treeName = paramsObj.getStr(GenConstants.TREE_NAME);
|
||||
Long parentMenuId = paramsObj.getLong(GenConstants.PARENT_MENU_ID);
|
||||
Long parentMenuId = Convert.toLong(TemplateEngineUtils.getParentMenuId(paramsObj));
|
||||
String parentMenuName = paramsObj.getStr(GenConstants.PARENT_MENU_NAME);
|
||||
Boolean enableExport = Convert.toBool(paramsObj.get(GenConstants.ENABLE_EXPORT), true);
|
||||
Boolean enableStatus = Convert.toBool(paramsObj.get(GenConstants.ENABLE_STATUS), false);
|
||||
@@ -648,6 +650,5 @@ public class GenTableServiceImpl implements IGenTableService {
|
||||
genTable.setTreeAncestorsField(treeAncestorsField);
|
||||
genTable.setTreeOrderField(treeOrderField);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class TemplateEngineUtils {
|
||||
/**
|
||||
* 默认上级菜单,系统工具
|
||||
*/
|
||||
private static final String DEFAULT_PARENT_MENU_ID = "3";
|
||||
private static final String DEFAULT_PARENT_MENU_ID = "1761400000000000003";
|
||||
|
||||
// 模板引擎
|
||||
private static final TemplateEngine TEMPLATE_ENGINE;
|
||||
@@ -102,7 +102,7 @@ public class TemplateEngineUtils {
|
||||
context.put("basePackage", getPackagePrefix(packageName));
|
||||
context.put("packageName", packageName);
|
||||
context.put("author", genTable.getFunctionAuthor());
|
||||
context.put("datetime", DateUtils.getDate());
|
||||
context.put("datetime", DateUtils.now());
|
||||
context.put("pkColumn", genTable.getPkColumn());
|
||||
context.put("importList", getImportList(genTable));
|
||||
context.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
||||
|
||||
@@ -33,7 +33,7 @@ public class AlipayBillTask {
|
||||
// 设置清算日期
|
||||
String settlementDate = (String) jobArgs.getWfContext().get("settlementDate");
|
||||
if (StringUtils.equals(settlementDate, "sysdate")) {
|
||||
settlementDate = DateUtils.getDate();
|
||||
settlementDate = DateUtils.now();
|
||||
}
|
||||
BillDTO billDTO = new BillDTO(23456789L, "alipay", settlementDate, new BigDecimal("2345.67"));
|
||||
// 把billDTO对象放入上下文进行传递
|
||||
|
||||
@@ -34,7 +34,7 @@ public class WechatBillTask {
|
||||
// 是sysdate设置为当前日期;否则取管理页面设置的值
|
||||
String settlementDate = (String) jobArgs.getWfContext().get("settlementDate");
|
||||
if (StringUtils.equals(settlementDate, "sysdate")) {
|
||||
settlementDate = DateUtils.getDate();
|
||||
settlementDate = DateUtils.now();
|
||||
}
|
||||
BillDTO billDTO = new BillDTO(123456789L, "wechat", settlementDate, new BigDecimal("1234.56"));
|
||||
// 把billDTO对象放入上下文进行传递
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ public class SysDeptController extends BaseController {
|
||||
*/
|
||||
@SaCheckPermission("system:dept:list")
|
||||
@GetMapping("/list/exclude/{deptId}")
|
||||
public R<List<SysDeptVo>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
|
||||
public R<List<SysDeptVo>> excludeChild(@PathVariable(value = "deptId") Long deptId) {
|
||||
List<SysDeptVo> depts = deptService.selectDeptList(new SysDeptBo());
|
||||
depts.removeIf(d -> d.getDeptId().equals(deptId)
|
||||
|| StringUtils.splitList(d.getAncestors()).contains(Convert.toStr(deptId)));
|
||||
|
||||
+4
-2
@@ -7,10 +7,12 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.PageResult;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.QueryGroup;
|
||||
import org.dromara.common.json.utils.JsonUtils;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.SysOssExt;
|
||||
import org.dromara.system.domain.bo.SysOssBo;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
@@ -73,8 +75,8 @@ public class SysOssController extends BaseController {
|
||||
@SaCheckPermission("system:oss:upload")
|
||||
@Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) {
|
||||
SysOssVo oss = ossService.upload(file);
|
||||
public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file, @RequestParam(value = "ossExt", required = false) String ossExtJson) {
|
||||
SysOssVo oss = ossService.upload(file, JsonUtils.parseObject(ossExtJson, SysOssExt.class));
|
||||
SysOssUploadVo uploadVo = new SysOssUploadVo(oss.getUrl(), oss.getOriginalName(), oss.getOssId().toString());
|
||||
return R.ok(uploadVo);
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,12 +54,12 @@ public class SysClientVo implements Serializable {
|
||||
/**
|
||||
* 授权类型
|
||||
*/
|
||||
@ExcelProperty(value = "授权类型")
|
||||
private List<String> grantTypeList;
|
||||
|
||||
/**
|
||||
* 授权类型
|
||||
*/
|
||||
@ExcelProperty(value = "授权类型")
|
||||
private String grantType;
|
||||
|
||||
/**
|
||||
|
||||
+5
-2
@@ -2,6 +2,7 @@ package org.dromara.system.service;
|
||||
|
||||
import org.dromara.common.core.domain.PageResult;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.system.domain.SysOssExt;
|
||||
import org.dromara.system.domain.bo.SysOssBo;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -47,17 +48,19 @@ public interface ISysOssService {
|
||||
* 上传 MultipartFile 到对象存储服务,并保存文件信息到数据库
|
||||
*
|
||||
* @param file 要上传的 MultipartFile 对象
|
||||
* @param ossExt 扩展信息
|
||||
* @return 上传成功后的 SysOssVo 对象,包含文件信息
|
||||
*/
|
||||
SysOssVo upload(MultipartFile file);
|
||||
SysOssVo upload(MultipartFile file, SysOssExt ossExt);
|
||||
|
||||
/**
|
||||
* 上传文件到对象存储服务,并保存文件信息到数据库
|
||||
*
|
||||
* @param file 要上传的文件对象
|
||||
* @param ossExt 扩展信息
|
||||
* @return 上传成功后的 SysOssVo 对象,包含文件信息
|
||||
*/
|
||||
SysOssVo upload(File file);
|
||||
SysOssVo upload(File file, SysOssExt ossExt);
|
||||
|
||||
/**
|
||||
* 文件下载方法,支持一次性下载完整文件
|
||||
|
||||
+7
-7
@@ -230,7 +230,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
* @throws ServiceException 如果上传过程中发生异常,则抛出 ServiceException 异常
|
||||
*/
|
||||
@Override
|
||||
public SysOssVo upload(MultipartFile file) {
|
||||
public SysOssVo upload(MultipartFile file, SysOssExt ossExt) {
|
||||
if (ObjectUtil.isNull(file) || file.isEmpty()) {
|
||||
throw new ServiceException("上传文件不能为空");
|
||||
}
|
||||
@@ -240,11 +240,11 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
String pathKey = instance.buildPathKey(originalfileName);
|
||||
try (InputStream inputStream = file.getInputStream()) {
|
||||
PutObjectResult result = instance.upload(pathKey, inputStream, file.getSize(), Options.builder().setContentType(file.getContentType()));
|
||||
SysOssExt ext1 = new SysOssExt();
|
||||
ext1.setFileSize(file.getSize());
|
||||
ext1.setContentType(file.getContentType());
|
||||
ossExt = ossExt == null ? new SysOssExt() : ossExt;
|
||||
ossExt.setFileSize(file.getSize());
|
||||
ossExt.setContentType(file.getContentType());
|
||||
// 保存文件信息
|
||||
return buildResultEntity(originalfileName, suffix, instance.clientId(), result, ext1);
|
||||
return buildResultEntity(originalfileName, suffix, instance.clientId(), result, ossExt);
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
@@ -257,7 +257,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
* @return 上传成功后的 SysOssVo 对象,包含文件信息
|
||||
*/
|
||||
@Override
|
||||
public SysOssVo upload(File file) {
|
||||
public SysOssVo upload(File file, SysOssExt ossExt) {
|
||||
if (ObjectUtil.isNull(file) || !file.isFile() || file.length() <= 0) {
|
||||
throw new ServiceException("上传文件不能为空");
|
||||
}
|
||||
@@ -266,7 +266,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
OssClient instance = OssFactory.instance();
|
||||
String pathKey = instance.buildPathKey(originalfileName);
|
||||
PutObjectResult result = instance.upload(pathKey, file, Options.builder().setContentType(FileUtils.getMimeType(file.toPath())));
|
||||
SysOssExt ext1 = new SysOssExt();
|
||||
SysOssExt ext1 = ossExt == null ? new SysOssExt() : ossExt;
|
||||
ext1.setFileSize(result.size());
|
||||
// 保存文件信息
|
||||
return buildResultEntity(originalfileName, suffix, instance.clientId(), result, ext1);
|
||||
|
||||
+1
-1
@@ -239,7 +239,7 @@ public class FlowHisTaskVo implements Serializable {
|
||||
private void updateRunDuration() {
|
||||
// 如果创建时间和更新时间均不为空,计算它们之间的时长
|
||||
if (this.updateTime != null && this.createTime != null) {
|
||||
this.runDuration = DateUtils.getTimeDifference(this.updateTime, this.createTime);
|
||||
this.runDuration = DateUtils.formatBetweenBySecond(this.updateTime, this.createTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -207,7 +207,7 @@ public class WorkflowGlobalListener implements GlobalListener {
|
||||
}
|
||||
if (!BusinessStatusEnum.initialState(instance.getFlowStatus())) {
|
||||
if (task != null && CollUtil.isNotEmpty(nextTasks) && nextTasks.size() == 1
|
||||
&& flwCommonService.applyNodeCode(definition.getId()).equals(nextTasks.get(0).getNodeCode())) {
|
||||
&& flwCommonService.applyNodeCode(definition.getId()).equals(nextTasks.getFirst().getNodeCode())) {
|
||||
// 如果为画线指定驳回 线条指定为驳回 驳回得节点为申请人节点 则修改流程状态为退回
|
||||
flowProcessEventHandler.processHandler(definition.getFlowCode(), instance, BusinessStatusEnum.BACK.getStatus(), params, false);
|
||||
notifyInitiatorIfNeeded(definition, instance, BusinessStatusEnum.BACK.getStatus(), variable);
|
||||
@@ -274,7 +274,7 @@ public class WorkflowGlobalListener implements GlobalListener {
|
||||
}
|
||||
// 只有“退回到申请人”场景需要拦截待办提醒,其余退回/流转仍然保留待办消息。
|
||||
String applyNodeCode = flwCommonService.applyNodeCode(definition.getId());
|
||||
return !StringUtils.equals(applyNodeCode, nextTasks.get(0).getNodeCode());
|
||||
return !StringUtils.equals(applyNodeCode, nextTasks.getFirst().getNodeCode());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
-1
@@ -3,7 +3,6 @@ package org.dromara.workflow.service.impl;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.dromara.common.translation.annotation.TranslationType;
|
||||
import org.dromara.common.translation.core.TranslationInterface;
|
||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||
|
||||
+1
-1
@@ -202,7 +202,7 @@ public class FlwChartExtServiceImpl implements ChartExtService {
|
||||
// 添加具体信息项:账号、耗时、时间
|
||||
info.add(buildInfoItem("用户账号", userDTO.getUserName()));
|
||||
info.add(buildInfoItem("审批状态", dictType.get(task.getFlowStatus())));
|
||||
info.add(buildInfoItem("审批耗时", DateUtils.getTimeDifference(task.getUpdateTime(), task.getCreateTime())));
|
||||
info.add(buildInfoItem("审批耗时", DateUtils.formatBetweenBySecond(task.getUpdateTime(), task.getCreateTime())));
|
||||
info.add(buildInfoItem("办理时间", DateUtils.formatDateTime(task.getUpdateTime())));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -189,6 +189,6 @@ public class FlwCommonServiceImpl implements IFlwCommonService {
|
||||
if (CollUtil.isEmpty(firstBetweenNode)) {
|
||||
throw new ServiceException("流程定义缺少申请人节点,请检查流程定义配置");
|
||||
}
|
||||
return firstBetweenNode.get(0).getNodeCode();
|
||||
return firstBetweenNode.getFirst().getNodeCode();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -189,7 +189,7 @@ public class FlwTaskAssigneeServiceImpl implements IFlwTaskAssigneeService, Hand
|
||||
.setHandlerCode(assignee -> StringUtils.blankToDefault(assignee.getHandlerCode(), "无"))
|
||||
.setHandlerName(assignee -> StringUtils.blankToDefault(assignee.getHandlerName(), "无"))
|
||||
.setGroupName(assignee -> this.getGroupName(type, assignee.getGroupName()))
|
||||
.setCreateTime(assignee -> DateUtils.formatDateTime(assignee.getCreateTime()));
|
||||
.setCreateTime(assignee -> DateUtils.formatLocalDateTime(assignee.getCreateTime()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-4
@@ -133,7 +133,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
}
|
||||
taskService.mergeVariable(flowInstance, variables);
|
||||
insService.updateById(flowInstance);
|
||||
StartProcessReturnDTO dto = new StartProcessReturnDTO(taskList.get(0).getInstanceId(), taskList.get(0).getId());
|
||||
StartProcessReturnDTO dto = new StartProcessReturnDTO(taskList.getFirst().getInstanceId(), taskList.getFirst().getId());
|
||||
// 保存流程实例业务信息
|
||||
this.buildFlowInstanceBizExt(flowInstance, bizExt);
|
||||
return dto;
|
||||
@@ -164,7 +164,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
if (taskList.size() > 1) {
|
||||
throw new ServiceException("请检查流程第一个环节是否为申请人!");
|
||||
}
|
||||
return new StartProcessReturnDTO(instance.getId(), taskList.get(0).getId());
|
||||
return new StartProcessReturnDTO(instance.getId(), taskList.getFirst().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,7 +345,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
if (CollUtil.isEmpty(flowHisTasks)) {
|
||||
throw new ServiceException("流程历史任务不存在,无法添加抄送记录");
|
||||
}
|
||||
FlowHisTask flowHisTask = flowHisTasks.get(0);
|
||||
FlowHisTask flowHisTask = flowHisTasks.getFirst();
|
||||
FlowNode flowNode = new FlowNode();
|
||||
flowNode.setNodeCode(flowHisTask.getTargetNodeCode());
|
||||
flowNode.setNodeName(flowHisTask.getTargetNodeName());
|
||||
@@ -544,7 +544,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
return nodeCodes;
|
||||
}
|
||||
//判断是否配置了固定驳回节点
|
||||
Node node = nodeCodes.get(0);
|
||||
Node node = nodeCodes.getFirst();
|
||||
if (StringUtils.isNotBlank(node.getAnyNodeSkip())) {
|
||||
return nodeService.getByNodeCodes(Collections.singletonList(node.getAnyNodeSkip()), task.getDefinitionId());
|
||||
}
|
||||
|
||||
@@ -103,7 +103,8 @@ services:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
SERVER_PORT: 8080
|
||||
SNAIL_PORT: 28080
|
||||
SNAIL_JOB_PORT: 28080
|
||||
SNAIL_AI_PORT: 38080
|
||||
volumes:
|
||||
# 配置文件
|
||||
- /docker/server1/logs/:/ruoyi/server/logs/
|
||||
@@ -119,7 +120,8 @@ services:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
SERVER_PORT: 8081
|
||||
SNAIL_PORT: 28081
|
||||
SNAIL_JOB_PORT: 28081
|
||||
SNAIL_AI_PORT: 38081
|
||||
volumes:
|
||||
# 配置文件
|
||||
- /docker/server2/logs/:/ruoyi/server/logs/
|
||||
@@ -153,3 +155,17 @@ services:
|
||||
- /docker/snailjob/logs/:/ruoyi/snailjob/logs
|
||||
privileged: true
|
||||
network_mode: "host"
|
||||
|
||||
ruoyi-snailai-server:
|
||||
image: ruoyi/ruoyi-snailai-server:5.5.3
|
||||
container_name: ruoyi-snailai-server
|
||||
environment:
|
||||
# 时区上海
|
||||
TZ: Asia/Shanghai
|
||||
ports:
|
||||
- "8900:8900"
|
||||
- "18888:18888"
|
||||
volumes:
|
||||
- /docker/snailai/logs/:/ruoyi/snailai/logs
|
||||
privileged: true
|
||||
network_mode: "host"
|
||||
|
||||
Reference in New Issue
Block a user