mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-23 23:09:47 +08:00
Compare commits
70 Commits
c01ed34602
...
5.X
Author | SHA1 | Date | |
---|---|---|---|
b30ffa952f | |||
f616c6931c | |||
26e10293f5 | |||
60e578f763 | |||
5cd4d8ca11 | |||
41a6230b6e | |||
effda4f6e8 | |||
af4c38e439 | |||
fafa8cd573 | |||
8909b8a7d4 | |||
8ae9bde731 | |||
a703cb2ad1 | |||
a918b880d6 | |||
e795e315eb | |||
81869cfeb3 | |||
fc6f61bc95 | |||
d44e45ad3b | |||
00ed9ddd10 | |||
341fc144a1 | |||
b6b1b2de18 | |||
c19f2b9e4e | |||
3a11f18656 | |||
5a43212ccc | |||
f4cfd1c913 | |||
26ce8f30c9 | |||
2258962770 | |||
655e84012c | |||
f683ef00b8 | |||
424b2ea164 | |||
7bb4838132 | |||
20516758ea | |||
2d5f84ebc2 | |||
6bc28e41de | |||
a4fb3fadaf | |||
cfa67fcd8c | |||
e5e8d305d2 | |||
9d0084409e | |||
ee02f46dfd | |||
25de0b3530 | |||
aa76859a05 | |||
71b70a59fe | |||
05c9528549 | |||
1feb2a3861 | |||
237e78e80c | |||
ffc3dcaec9 | |||
a94e474069 | |||
40a0e57870 | |||
fd5d028e95 | |||
64100cf1ff | |||
7e7d857ba5 | |||
d22b2a10df | |||
957a4d1fcd | |||
49ef8378fe | |||
57dd6831d3 | |||
8aa60abb1f | |||
7a9f51fc7a | |||
159e30c982 | |||
7334d91d6b | |||
95c01301f6 | |||
296466fa13 | |||
3c8d864b5f | |||
ea50a57602 | |||
7e14b98676 | |||
015b406001 | |||
098d3347a0 | |||
08d4493994 | |||
367d739e2d | |||
d6688a367d | |||
0b331796e2 | |||
456620b638 |
@ -2,7 +2,7 @@
|
||||
<configuration default="false" name="ruoyi-monitor-admin" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="ruoyi/ruoyi-monitor-admin:5.4.1" />
|
||||
<option name="imageTag" value="ruoyi/ruoyi-monitor-admin:5.5.0" />
|
||||
<option name="buildOnly" value="true" />
|
||||
<option name="sourceFilePath" value="ruoyi-extend/ruoyi-monitor-admin/Dockerfile" />
|
||||
</settings>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<configuration default="false" name="ruoyi-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="ruoyi/ruoyi-server:5.4.1" />
|
||||
<option name="imageTag" value="ruoyi/ruoyi-server:5.5.0" />
|
||||
<option name="buildOnly" value="true" />
|
||||
<option name="sourceFilePath" value="ruoyi-admin/Dockerfile" />
|
||||
</settings>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<configuration default="false" name="ruoyi-snailjob-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="ruoyi/ruoyi-snailjob-server:5.4.1" />
|
||||
<option name="imageTag" value="ruoyi/ruoyi-snailjob-server:5.5.0" />
|
||||
<option name="buildOnly" value="true" />
|
||||
<option name="sourceFilePath" value="ruoyi-extend/ruoyi-snailjob-server/Dockerfile" />
|
||||
</settings>
|
||||
|
@ -10,7 +10,7 @@
|
||||
[](https://gitee.com/dromara/RuoYi-Vue-Plus/blob/5.X/LICENSE)
|
||||
[](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
|
||||
<br>
|
||||
[](https://gitee.com/dromara/RuoYi-Vue-Plus)
|
||||
[](https://gitee.com/dromara/RuoYi-Vue-Plus)
|
||||
[]()
|
||||
[]()
|
||||
[]()
|
||||
|
20
pom.xml
20
pom.xml
@ -13,28 +13,28 @@
|
||||
<description>Dromara RuoYi-Vue-Plus多租户管理系统</description>
|
||||
|
||||
<properties>
|
||||
<revision>5.4.1</revision>
|
||||
<spring-boot.version>3.5.4</spring-boot.version>
|
||||
<revision>5.5.0</revision>
|
||||
<spring-boot.version>3.5.6</spring-boot.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>17</java.version>
|
||||
<mybatis.version>3.5.16</mybatis.version>
|
||||
<springdoc.version>2.8.11</springdoc.version>
|
||||
<springdoc.version>2.8.13</springdoc.version>
|
||||
<therapi-javadoc.version>0.15.0</therapi-javadoc.version>
|
||||
<fastexcel.version>1.3.0</fastexcel.version>
|
||||
<velocity.version>2.3</velocity.version>
|
||||
<satoken.version>1.44.0</satoken.version>
|
||||
<mybatis-plus.version>3.5.12</mybatis-plus.version>
|
||||
<mybatis-plus.version>3.5.14</mybatis-plus.version>
|
||||
<p6spy.version>3.9.1</p6spy.version>
|
||||
<hutool.version>5.8.38</hutool.version>
|
||||
<spring-boot-admin.version>3.5.1</spring-boot-admin.version>
|
||||
<hutool.version>5.8.40</hutool.version>
|
||||
<spring-boot-admin.version>3.5.3</spring-boot-admin.version>
|
||||
<redisson.version>3.51.0</redisson.version>
|
||||
<lock4j.version>2.2.7</lock4j.version>
|
||||
<dynamic-ds.version>4.3.1</dynamic-ds.version>
|
||||
<snailjob.version>1.7.2</snailjob.version>
|
||||
<mapstruct-plus.version>1.4.8</mapstruct-plus.version>
|
||||
<snailjob.version>1.8.0</snailjob.version>
|
||||
<mapstruct-plus.version>1.5.0</mapstruct-plus.version>
|
||||
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
|
||||
<lombok.version>1.18.38</lombok.version>
|
||||
<lombok.version>1.18.40</lombok.version>
|
||||
<bouncycastle.version>1.80</bouncycastle.version>
|
||||
<justauth.version>1.16.7</justauth.version>
|
||||
<!-- 离线IP地址定位库 -->
|
||||
@ -42,7 +42,7 @@
|
||||
<!-- OSS 配置 -->
|
||||
<aws.sdk.version>2.28.22</aws.sdk.version>
|
||||
<!-- SMS 配置 -->
|
||||
<sms4j.version>3.3.4</sms4j.version>
|
||||
<sms4j.version>3.3.5</sms4j.version>
|
||||
<!-- 限制框架中的fastjson版本 -->
|
||||
<fastjson.version>1.2.83</fastjson.version>
|
||||
<!-- 面向运行时的D-ORM依赖 -->
|
||||
|
@ -131,15 +131,18 @@ public class CaptchaController {
|
||||
String verifyKey = GlobalConstants.CAPTCHA_CODE_KEY + uuid;
|
||||
// 生成验证码
|
||||
CaptchaType captchaType = captchaProperties.getType();
|
||||
boolean isMath = CaptchaType.MATH == captchaType;
|
||||
Integer length = isMath ? captchaProperties.getNumberLength() : captchaProperties.getCharLength();
|
||||
CodeGenerator codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), length);
|
||||
CodeGenerator codeGenerator;
|
||||
if (CaptchaType.MATH == captchaType) {
|
||||
codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), captchaProperties.getNumberLength(), false);
|
||||
} else {
|
||||
codeGenerator = ReflectUtils.newInstance(captchaType.getClazz(), captchaProperties.getCharLength());
|
||||
}
|
||||
AbstractCaptcha captcha = SpringUtils.getBean(captchaProperties.getCategory().getClazz());
|
||||
captcha.setGenerator(codeGenerator);
|
||||
captcha.createCode();
|
||||
// 如果是数学验证码,使用SpEL表达式处理验证码结果
|
||||
String code = captcha.getCode();
|
||||
if (isMath) {
|
||||
if (CaptchaType.MATH == captchaType) {
|
||||
ExpressionParser parser = new SpelExpressionParser();
|
||||
Expression exp = parser.parseExpression(StringUtils.remove(code, "="));
|
||||
code = exp.getValue(String.class);
|
||||
|
@ -259,5 +259,7 @@ warm-flow:
|
||||
ui: true
|
||||
# 是否显示流程图顶部文字
|
||||
top-text-show: true
|
||||
# 是否渲染节点悬浮提示,默认true
|
||||
node-tooltip: true
|
||||
# 默认Authorization,如果有多个token,用逗号分隔
|
||||
token-name: ${sa-token.token-name},clientid
|
||||
|
Binary file not shown.
@ -38,7 +38,7 @@
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log.gz</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
@ -60,7 +60,7 @@
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log.gz</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
|
@ -14,7 +14,7 @@
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
<revision>5.4.1</revision>
|
||||
<revision>5.5.0</revision>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
|
@ -72,5 +72,10 @@ public interface Constants {
|
||||
*/
|
||||
Long TOP_PARENT_ID = 0L;
|
||||
|
||||
/**
|
||||
* 加密头
|
||||
*/
|
||||
String ENCRYPT_HEADER = "ENC_";
|
||||
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,10 @@ public class StreamUtils {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
// 注意此处不要使用 .toList() 新语法 因为返回的是不可变List 会导致序列化问题
|
||||
return collection.stream().filter(function).collect(Collectors.toList());
|
||||
return collection.stream()
|
||||
.filter(function)
|
||||
// 注意此处不要使用 .toList() 新语法 因为返回的是不可变List 会导致序列化问题
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,13 +41,26 @@ public class StreamUtils {
|
||||
*
|
||||
* @param collection 需要查询的集合
|
||||
* @param function 过滤方法
|
||||
* @return 找到符合条件的第一个元素,没有则返回null
|
||||
* @return 找到符合条件的第一个元素,没有则返回 Optional.empty()
|
||||
*/
|
||||
public static <E> E findFirst(Collection<E> collection, Predicate<E> function) {
|
||||
public static <E> Optional<E> findFirst(Collection<E> collection, Predicate<E> function) {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return null;
|
||||
return Optional.empty();
|
||||
}
|
||||
return collection.stream().filter(function).findFirst().orElse(null);
|
||||
return collection.stream()
|
||||
.filter(function)
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
* 找到流中满足条件的第一个元素值
|
||||
*
|
||||
* @param collection 需要查询的集合
|
||||
* @param function 过滤方法
|
||||
* @return 找到符合条件的第一个元素,没有则返回 null
|
||||
*/
|
||||
public static <E> E findFirstValue(Collection<E> collection, Predicate<E> function) {
|
||||
return findFirst(collection,function).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,13 +68,26 @@ public class StreamUtils {
|
||||
*
|
||||
* @param collection 需要查询的集合
|
||||
* @param function 过滤方法
|
||||
* @return 找到符合条件的任意一个元素,没有则返回null
|
||||
* @return 找到符合条件的任意一个元素,没有则返回 Optional.empty()
|
||||
*/
|
||||
public static <E> Optional<E> findAny(Collection<E> collection, Predicate<E> function) {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return collection.stream().filter(function).findAny();
|
||||
return collection.stream()
|
||||
.filter(function)
|
||||
.findAny();
|
||||
}
|
||||
|
||||
/**
|
||||
* 找到流中任意一个满足条件的元素值
|
||||
*
|
||||
* @param collection 需要查询的集合
|
||||
* @param function 过滤方法
|
||||
* @return 找到符合条件的任意一个元素,没有则返回null
|
||||
*/
|
||||
public static <E> E findAnyValue(Collection<E> collection, Predicate<E> function) {
|
||||
return findAny(collection,function).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,7 +113,10 @@ public class StreamUtils {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return collection.stream().map(function).filter(Objects::nonNull).collect(Collectors.joining(delimiter));
|
||||
return collection.stream()
|
||||
.map(function)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.joining(delimiter));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,8 +130,11 @@ public class StreamUtils {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
// 注意此处不要使用 .toList() 新语法 因为返回的是不可变List 会导致序列化问题
|
||||
return collection.stream().filter(Objects::nonNull).sorted(comparing).collect(Collectors.toList());
|
||||
return collection.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.sorted(comparing)
|
||||
// 注意此处不要使用 .toList() 新语法 因为返回的是不可变List 会导致序列化问题
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,7 +151,9 @@ public class StreamUtils {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return MapUtil.newHashMap();
|
||||
}
|
||||
return collection.stream().filter(Objects::nonNull).collect(Collectors.toMap(key, Function.identity(), (l, r) -> l));
|
||||
return collection.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toMap(key, Function.identity(), (l, r) -> l));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,7 +172,25 @@ public class StreamUtils {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return MapUtil.newHashMap();
|
||||
}
|
||||
return collection.stream().filter(Objects::nonNull).collect(Collectors.toMap(key, value, (l, r) -> l));
|
||||
return collection.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toMap(key, value, (l, r) -> l));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 map 中的数据作为新 Map 的 value ,key 不变
|
||||
* @param map 需要处理的map
|
||||
* @param take 取值函数
|
||||
* @param <K> map中的key类型
|
||||
* @param <E> map中的value类型
|
||||
* @param <V> 新map中的value类型
|
||||
* @return 新的map
|
||||
*/
|
||||
public static <K, E, V> Map<K, V> toMap(Map<K, E> map, BiFunction<K, E, V> take) {
|
||||
if (CollUtil.isEmpty(map)) {
|
||||
return MapUtil.newHashMap();
|
||||
}
|
||||
return toMap(map.entrySet(), Map.Entry::getKey, entry -> take.apply(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -153,8 +207,8 @@ public class StreamUtils {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return MapUtil.newHashMap();
|
||||
}
|
||||
return collection
|
||||
.stream().filter(Objects::nonNull)
|
||||
return collection.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.groupingBy(key, LinkedHashMap::new, Collectors.toList()));
|
||||
}
|
||||
|
||||
@ -174,8 +228,8 @@ public class StreamUtils {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return MapUtil.newHashMap();
|
||||
}
|
||||
return collection
|
||||
.stream().filter(Objects::nonNull)
|
||||
return collection.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.groupingBy(key1, LinkedHashMap::new, Collectors.groupingBy(key2, LinkedHashMap::new, Collectors.toList())));
|
||||
}
|
||||
|
||||
@ -192,11 +246,11 @@ public class StreamUtils {
|
||||
* @return 分类后的map
|
||||
*/
|
||||
public static <E, T, U> Map<T, Map<U, E>> group2Map(Collection<E> collection, Function<E, T> key1, Function<E, U> key2) {
|
||||
if (CollUtil.isEmpty(collection) || key1 == null || key2 == null) {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return MapUtil.newHashMap();
|
||||
}
|
||||
return collection
|
||||
.stream().filter(Objects::nonNull)
|
||||
return collection.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.groupingBy(key1, LinkedHashMap::new, Collectors.toMap(key2, Function.identity(), (l, r) -> l)));
|
||||
}
|
||||
|
||||
@ -214,8 +268,7 @@ public class StreamUtils {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
return collection
|
||||
.stream()
|
||||
return collection.stream()
|
||||
.map(function)
|
||||
.filter(Objects::nonNull)
|
||||
// 注意此处不要使用 .toList() 新语法 因为返回的是不可变List 会导致序列化问题
|
||||
@ -233,11 +286,10 @@ public class StreamUtils {
|
||||
* @return 转化后的Set
|
||||
*/
|
||||
public static <E, T> Set<T> toSet(Collection<E> collection, Function<E, T> function) {
|
||||
if (CollUtil.isEmpty(collection) || function == null) {
|
||||
if (CollUtil.isEmpty(collection)) {
|
||||
return CollUtil.newHashSet();
|
||||
}
|
||||
return collection
|
||||
.stream()
|
||||
return collection.stream()
|
||||
.map(function)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
@ -257,26 +309,20 @@ public class StreamUtils {
|
||||
* @return 合并后的map
|
||||
*/
|
||||
public static <K, X, Y, V> Map<K, V> merge(Map<K, X> map1, Map<K, Y> map2, BiFunction<X, Y, V> merge) {
|
||||
if (MapUtil.isEmpty(map1) && MapUtil.isEmpty(map2)) {
|
||||
if (CollUtil.isEmpty(map1) && CollUtil.isEmpty(map2)) {
|
||||
// 如果两个 map 都为空,则直接返回空的 map
|
||||
return MapUtil.newHashMap();
|
||||
} else if (MapUtil.isEmpty(map1)) {
|
||||
map1 = MapUtil.newHashMap();
|
||||
} else if (MapUtil.isEmpty(map2)) {
|
||||
map2 = MapUtil.newHashMap();
|
||||
} else if (CollUtil.isEmpty(map1)) {
|
||||
// 如果 map1 为空,则直接处理返回 map2
|
||||
return toMap(map2.entrySet(), Map.Entry::getKey, entry -> merge.apply(null, entry.getValue()));
|
||||
} else if (CollUtil.isEmpty(map2)) {
|
||||
// 如果 map2 为空,则直接处理返回 map1
|
||||
return toMap(map1.entrySet(), Map.Entry::getKey, entry -> merge.apply(entry.getValue(), null));
|
||||
}
|
||||
Set<K> key = new HashSet<>();
|
||||
key.addAll(map1.keySet());
|
||||
key.addAll(map2.keySet());
|
||||
Map<K, V> map = new HashMap<>();
|
||||
for (K t : key) {
|
||||
X x = map1.get(t);
|
||||
Y y = map2.get(t);
|
||||
V z = merge.apply(x, y);
|
||||
if (z != null) {
|
||||
map.put(t, z);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
Set<K> keySet = new HashSet<>();
|
||||
keySet.addAll(map1.keySet());
|
||||
keySet.addAll(map2.keySet());
|
||||
return toMap(keySet, key -> key, key -> merge.apply(map1.get(key), map2.get(key)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import cn.hutool.core.util.ReflectUtil;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.io.Resources;
|
||||
import org.dromara.common.core.constant.Constants;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.encrypt.annotation.EncryptField;
|
||||
@ -92,8 +93,12 @@ public class EncryptorManager {
|
||||
* @param encryptContext 加密相关的配置信息
|
||||
*/
|
||||
public String encrypt(String value, EncryptContext encryptContext) {
|
||||
if (StringUtils.startsWith(value, Constants.ENCRYPT_HEADER)) {
|
||||
return value;
|
||||
}
|
||||
IEncryptor encryptor = this.registAndGetEncryptor(encryptContext);
|
||||
return encryptor.encrypt(value, encryptContext.getEncode());
|
||||
String encrypt = encryptor.encrypt(value, encryptContext.getEncode());
|
||||
return Constants.ENCRYPT_HEADER + encrypt;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -103,8 +108,12 @@ public class EncryptorManager {
|
||||
* @param encryptContext 加密相关的配置信息
|
||||
*/
|
||||
public String decrypt(String value, EncryptContext encryptContext) {
|
||||
if (!StringUtils.startsWith(value, Constants.ENCRYPT_HEADER)) {
|
||||
return value;
|
||||
}
|
||||
IEncryptor encryptor = this.registAndGetEncryptor(encryptContext);
|
||||
return encryptor.decrypt(value);
|
||||
String str = StringUtils.removeStart(value, Constants.ENCRYPT_HEADER);
|
||||
return encryptor.decrypt(str);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,12 +31,89 @@ public class CellMergeHandler {
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public List<CellRangeAddress> handle(List<?> list) {
|
||||
List<CellRangeAddress> cellList = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return cellList;
|
||||
public List<CellRangeAddress> handle(List<?> rows) {
|
||||
// 如果入参为空集合则返回空集
|
||||
if (CollUtil.isEmpty(rows)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
Class<?> clazz = list.get(0).getClass();
|
||||
|
||||
// 获取有合并注解的字段
|
||||
Map<Field, FieldColumnIndex> mergeFields = getFieldColumnIndexMap(rows.get(0).getClass());
|
||||
// 如果没有需要合并的字段则返回空集
|
||||
if (CollUtil.isEmpty(mergeFields)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 结果集
|
||||
List<CellRangeAddress> result = new ArrayList<>();
|
||||
|
||||
// 生成两两合并单元格
|
||||
Map<Field, RepeatCell> rowRepeatCellMap = new HashMap<>();
|
||||
for (Map.Entry<Field, FieldColumnIndex> item : mergeFields.entrySet()) {
|
||||
Field field = item.getKey();
|
||||
FieldColumnIndex itemValue = item.getValue();
|
||||
int colNum = itemValue.colIndex();
|
||||
CellMerge cellMerge = itemValue.cellMerge();
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
// 当前行数据
|
||||
Object currentRowObj = rows.get(i);
|
||||
// 当前行数据字段值
|
||||
Object currentRowObjFieldVal = ReflectUtils.invokeGetter(currentRowObj, field.getName());
|
||||
|
||||
// 空值跳过不处理
|
||||
if (currentRowObjFieldVal == null || "".equals(currentRowObjFieldVal)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 单元格合并Map是否存在数据,如果不存在则添加当前行的字段值
|
||||
if (!rowRepeatCellMap.containsKey(field)) {
|
||||
rowRepeatCellMap.put(field, RepeatCell.of(currentRowObjFieldVal, i));
|
||||
continue;
|
||||
}
|
||||
|
||||
// 获取 单元格合并Map 中字段值
|
||||
RepeatCell repeatCell = rowRepeatCellMap.get(field);
|
||||
Object cellValue = repeatCell.value();
|
||||
int current = repeatCell.current();
|
||||
|
||||
// 检查是否满足合并条件
|
||||
// currentRowObj 当前行数据
|
||||
// rows.get(i - 1) 上一行数据 注:由于 if (!rowRepeatCellMap.containsKey(field)) 条件的存在,所以该 i 必不可能小于1
|
||||
// cellMerge 当前行字段合并注解
|
||||
boolean merge = isMerge(currentRowObj, rows.get(i - 1), cellMerge);
|
||||
|
||||
// 是否添加到结果集
|
||||
boolean isAddResult = false;
|
||||
// 最新行
|
||||
int lastRow = i + rowIndex - 1;
|
||||
|
||||
// 如果当前行字段值和缓存中的字段值不相等,或不满足合并条件,则替换
|
||||
if (!currentRowObjFieldVal.equals(cellValue) || !merge) {
|
||||
rowRepeatCellMap.put(field, RepeatCell.of(currentRowObjFieldVal, i));
|
||||
isAddResult = true;
|
||||
}
|
||||
|
||||
// 如果最后一行不能合并,检查之前的数据是否需要合并;如果最后一行可以合并,则直接合并到最后
|
||||
if (i == rows.size() - 1) {
|
||||
isAddResult = true;
|
||||
if (i > current) {
|
||||
lastRow = i + rowIndex;
|
||||
}
|
||||
}
|
||||
|
||||
if (isAddResult && i > current) {
|
||||
result.add(new CellRangeAddress(current + rowIndex, lastRow, colNum, colNum));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取带有合并注解的字段列索引和合并注解信息Map集
|
||||
*/
|
||||
private Map<Field, FieldColumnIndex> getFieldColumnIndexMap(Class<?> clazz) {
|
||||
boolean annotationPresent = clazz.isAnnotationPresent(ExcelIgnoreUnannotated.class);
|
||||
Field[] fields = ReflectUtils.getFields(clazz, field -> {
|
||||
if ("serialVersionUID".equals(field.getName())) {
|
||||
@ -49,86 +126,57 @@ public class CellMergeHandler {
|
||||
});
|
||||
|
||||
// 有注解的字段
|
||||
List<Field> mergeFields = new ArrayList<>();
|
||||
List<Integer> mergeFieldsIndex = new ArrayList<>();
|
||||
Map<Field, FieldColumnIndex> mergeFields = new HashMap<>();
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
Field field = fields[i];
|
||||
if (field.isAnnotationPresent(CellMerge.class)) {
|
||||
CellMerge cm = field.getAnnotation(CellMerge.class);
|
||||
mergeFields.add(field);
|
||||
mergeFieldsIndex.add(cm.index() == -1 ? i : cm.index());
|
||||
if (hasTitle) {
|
||||
ExcelProperty property = field.getAnnotation(ExcelProperty.class);
|
||||
rowIndex = Math.max(rowIndex, property.value().length);
|
||||
}
|
||||
if (!field.isAnnotationPresent(CellMerge.class)) {
|
||||
continue;
|
||||
}
|
||||
CellMerge cm = field.getAnnotation(CellMerge.class);
|
||||
int index = cm.index() == -1 ? i : cm.index();
|
||||
mergeFields.put(field, FieldColumnIndex.of(index, cm));
|
||||
|
||||
if (hasTitle) {
|
||||
ExcelProperty property = field.getAnnotation(ExcelProperty.class);
|
||||
rowIndex = Math.max(rowIndex, property.value().length);
|
||||
}
|
||||
}
|
||||
|
||||
Map<Field, RepeatCell> map = new HashMap<>();
|
||||
// 生成两两合并单元格
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Object rowObj = list.get(i);
|
||||
for (int j = 0; j < mergeFields.size(); j++) {
|
||||
Field field = mergeFields.get(j);
|
||||
Object val = ReflectUtils.invokeGetter(rowObj, field.getName());
|
||||
|
||||
int colNum = mergeFieldsIndex.get(j);
|
||||
if (!map.containsKey(field)) {
|
||||
map.put(field, new RepeatCell(val, i));
|
||||
} else {
|
||||
RepeatCell repeatCell = map.get(field);
|
||||
Object cellValue = repeatCell.value();
|
||||
if (cellValue == null || "".equals(cellValue)) {
|
||||
// 空值跳过不合并
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!cellValue.equals(val)) {
|
||||
if ((i - repeatCell.current() > 1)) {
|
||||
cellList.add(new CellRangeAddress(repeatCell.current() + rowIndex, i + rowIndex - 1, colNum, colNum));
|
||||
}
|
||||
map.put(field, new RepeatCell(val, i));
|
||||
} else if (i == list.size() - 1) {
|
||||
if (!isMerge(list, i, field)) {
|
||||
// 如果最后一行不能合并,检查之前的数据是否需要合并
|
||||
if (i - repeatCell.current() > 1) {
|
||||
cellList.add(new CellRangeAddress(repeatCell.current() + rowIndex, i + rowIndex - 1, colNum, colNum));
|
||||
}
|
||||
} else if (i > repeatCell.current()) {
|
||||
// 如果最后一行可以合并,则直接合并到最后
|
||||
cellList.add(new CellRangeAddress(repeatCell.current() + rowIndex, i + rowIndex, colNum, colNum));
|
||||
}
|
||||
} else if (!isMerge(list, i, field)) {
|
||||
if ((i - repeatCell.current() > 1)) {
|
||||
cellList.add(new CellRangeAddress(repeatCell.current() + rowIndex, i + rowIndex - 1, colNum, colNum));
|
||||
}
|
||||
map.put(field, new RepeatCell(val, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return cellList;
|
||||
return mergeFields;
|
||||
}
|
||||
|
||||
private boolean isMerge(List<?> list, int i, Field field) {
|
||||
boolean isMerge = true;
|
||||
CellMerge cm = field.getAnnotation(CellMerge.class);
|
||||
final String[] mergeBy = cm.mergeBy();
|
||||
private boolean isMerge(Object currentRow, Object preRow, CellMerge cellMerge) {
|
||||
final String[] mergeBy = cellMerge.mergeBy();
|
||||
if (StrUtil.isAllNotBlank(mergeBy)) {
|
||||
//比对当前list(i)和list(i - 1)的各个属性值一一比对 如果全为真 则为真
|
||||
//比对当前行和上一行的各个属性值一一比对 如果全为真 则为真
|
||||
for (String fieldName : mergeBy) {
|
||||
final Object valCurrent = ReflectUtil.getFieldValue(list.get(i), fieldName);
|
||||
final Object valPre = ReflectUtil.getFieldValue(list.get(i - 1), fieldName);
|
||||
final Object valCurrent = ReflectUtil.getFieldValue(currentRow, fieldName);
|
||||
final Object valPre = ReflectUtil.getFieldValue(preRow, fieldName);
|
||||
if (!Objects.equals(valPre, valCurrent)) {
|
||||
//依赖字段如有任一不等值,则标记为不可合并
|
||||
isMerge = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isMerge;
|
||||
return true;
|
||||
}
|
||||
|
||||
record RepeatCell(Object value, int current) {}
|
||||
/**
|
||||
* 单元格合并
|
||||
*/
|
||||
record RepeatCell(Object value, int current) {
|
||||
static RepeatCell of(Object value, int current) {
|
||||
return new RepeatCell(value, current);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字段列索引和合并注解信息
|
||||
*/
|
||||
record FieldColumnIndex(int colIndex, CellMerge cellMerge) {
|
||||
static FieldColumnIndex of(int colIndex, CellMerge cellMerge) {
|
||||
return new FieldColumnIndex(colIndex, cellMerge);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个单元格合并处理器实例
|
||||
|
@ -27,6 +27,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Excel相关处理
|
||||
@ -203,6 +204,44 @@ public class ExcelUtil {
|
||||
builder.doWrite(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param headType 带Excel注解的类型
|
||||
* @param os 输出流
|
||||
* @param options Excel下拉可选项
|
||||
* @param consumer 导出助手消费函数
|
||||
*/
|
||||
public static <T> void exportExcel(Class<T> headType, OutputStream os, List<DropDownOptions> options, Consumer<ExcelWriterWrapper<T>> consumer) {
|
||||
try (ExcelWriter writer = FastExcel.write(os, headType)
|
||||
.autoCloseStream(false)
|
||||
// 自动适配
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
||||
// 大数值自动转换 防止失真
|
||||
.registerConverter(new ExcelBigNumberConvert())
|
||||
// 批注必填项处理
|
||||
.registerWriteHandler(new DataWriteHandler(headType))
|
||||
// 添加下拉框操作
|
||||
.registerWriteHandler(new ExcelDownHandler(options))
|
||||
.build()) {
|
||||
// 执行消费函数
|
||||
consumer.accept(ExcelWriterWrapper.of(writer));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param headType 带Excel注解的类型
|
||||
* @param os 输出流
|
||||
* @param consumer 导出助手消费函数
|
||||
*/
|
||||
public static <T> void exportExcel(Class<T> headType, OutputStream os, Consumer<ExcelWriterWrapper<T>> consumer) {
|
||||
exportExcel(headType, os, null, consumer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 单表多数据模板导出 模板格式为 {.属性}
|
||||
*
|
||||
|
@ -0,0 +1,127 @@
|
||||
package org.dromara.common.excel.utils;
|
||||
|
||||
import cn.idev.excel.ExcelWriter;
|
||||
import cn.idev.excel.FastExcel;
|
||||
import cn.idev.excel.context.WriteContext;
|
||||
import cn.idev.excel.write.builder.ExcelWriterSheetBuilder;
|
||||
import cn.idev.excel.write.builder.ExcelWriterTableBuilder;
|
||||
import cn.idev.excel.write.metadata.WriteSheet;
|
||||
import cn.idev.excel.write.metadata.WriteTable;
|
||||
import cn.idev.excel.write.metadata.fill.FillConfig;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* ExcelWriterWrapper Excel写出包装器
|
||||
* <br>
|
||||
* 提供了一组与 ExcelWriter 一一对应的写出方法,避免直接提供 ExcelWriter 而导致的一些不可控问题(比如提前关闭了IO流等)
|
||||
*
|
||||
* @author 秋辞未寒
|
||||
* @see ExcelWriter
|
||||
*/
|
||||
public record ExcelWriterWrapper<T>(ExcelWriter excelWriter) {
|
||||
|
||||
public void write(Collection<T> data, WriteSheet writeSheet) {
|
||||
excelWriter.write(data, writeSheet);
|
||||
}
|
||||
|
||||
public void write(Supplier<Collection<T>> supplier, WriteSheet writeSheet) {
|
||||
excelWriter.write(supplier.get(), writeSheet);
|
||||
}
|
||||
|
||||
public void write(Collection<T> data, WriteSheet writeSheet, WriteTable writeTable) {
|
||||
excelWriter.write(data, writeSheet, writeTable);
|
||||
}
|
||||
|
||||
public void write(Supplier<Collection<T>> supplier, WriteSheet writeSheet, WriteTable writeTable) {
|
||||
excelWriter.write(supplier.get(), writeSheet, writeTable);
|
||||
}
|
||||
|
||||
public void fill(Object data, WriteSheet writeSheet) {
|
||||
excelWriter.fill(data, writeSheet);
|
||||
}
|
||||
|
||||
public void fill(Object data, FillConfig fillConfig, WriteSheet writeSheet) {
|
||||
excelWriter.fill(data, fillConfig, writeSheet);
|
||||
}
|
||||
|
||||
public void fill(Supplier<Object> supplier, WriteSheet writeSheet) {
|
||||
excelWriter.fill(supplier, writeSheet);
|
||||
}
|
||||
|
||||
public void fill(Supplier<Object> supplier, FillConfig fillConfig, WriteSheet writeSheet) {
|
||||
excelWriter.fill(supplier, fillConfig, writeSheet);
|
||||
}
|
||||
|
||||
public WriteContext writeContext() {
|
||||
return excelWriter.writeContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个 ExcelWriterWrapper
|
||||
*
|
||||
* @param excelWriter ExcelWriter
|
||||
* @return ExcelWriterWrapper
|
||||
*/
|
||||
public static <T> ExcelWriterWrapper<T> of(ExcelWriter excelWriter) {
|
||||
return new ExcelWriterWrapper<>(excelWriter);
|
||||
}
|
||||
|
||||
// -------------------------------- sheet start
|
||||
|
||||
public static WriteSheet buildSheet(Integer sheetNo, String sheetName) {
|
||||
return sheetBuilder(sheetNo, sheetName).build();
|
||||
}
|
||||
|
||||
public static WriteSheet buildSheet(Integer sheetNo) {
|
||||
return sheetBuilder(sheetNo).build();
|
||||
}
|
||||
|
||||
public static WriteSheet buildSheet(String sheetName) {
|
||||
return sheetBuilder(sheetName).build();
|
||||
}
|
||||
|
||||
public static WriteSheet buildSheet() {
|
||||
return sheetBuilder().build();
|
||||
}
|
||||
|
||||
public static ExcelWriterSheetBuilder sheetBuilder(Integer sheetNo, String sheetName) {
|
||||
return FastExcel.writerSheet(sheetNo, sheetName);
|
||||
}
|
||||
|
||||
public static ExcelWriterSheetBuilder sheetBuilder(Integer sheetNo) {
|
||||
return FastExcel.writerSheet(sheetNo);
|
||||
}
|
||||
|
||||
public static ExcelWriterSheetBuilder sheetBuilder(String sheetName) {
|
||||
return FastExcel.writerSheet(sheetName);
|
||||
}
|
||||
|
||||
public static ExcelWriterSheetBuilder sheetBuilder() {
|
||||
return FastExcel.writerSheet();
|
||||
}
|
||||
|
||||
// -------------------------------- sheet end
|
||||
|
||||
// -------------------------------- table start
|
||||
|
||||
public static WriteTable buildTable(Integer tableNo) {
|
||||
return tableBuilder(tableNo).build();
|
||||
}
|
||||
|
||||
public static WriteTable buildTable() {
|
||||
return tableBuilder().build();
|
||||
}
|
||||
|
||||
public static ExcelWriterTableBuilder tableBuilder(Integer tableNo) {
|
||||
return FastExcel.writerTable(tableNo);
|
||||
}
|
||||
|
||||
public static ExcelWriterTableBuilder tableBuilder() {
|
||||
return FastExcel.writerTable();
|
||||
}
|
||||
|
||||
// -------------------------------- table end
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.common.json.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.Module;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
@ -28,20 +29,24 @@ import java.util.TimeZone;
|
||||
@AutoConfiguration(before = JacksonAutoConfiguration.class)
|
||||
public class JacksonConfig {
|
||||
|
||||
@Bean
|
||||
public Module registerJavaTimeModule() {
|
||||
// 全局配置序列化返回 JSON 处理
|
||||
JavaTimeModule javaTimeModule = new JavaTimeModule();
|
||||
javaTimeModule.addSerializer(Long.class, BigNumberSerializer.INSTANCE);
|
||||
javaTimeModule.addSerializer(Long.TYPE, BigNumberSerializer.INSTANCE);
|
||||
javaTimeModule.addSerializer(BigInteger.class, BigNumberSerializer.INSTANCE);
|
||||
javaTimeModule.addSerializer(BigDecimal.class, ToStringSerializer.instance);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(formatter));
|
||||
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter));
|
||||
javaTimeModule.addDeserializer(Date.class, new CustomDateDeserializer());
|
||||
return javaTimeModule;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer customizer() {
|
||||
return builder -> {
|
||||
// 全局配置序列化返回 JSON 处理
|
||||
JavaTimeModule javaTimeModule = new JavaTimeModule();
|
||||
javaTimeModule.addSerializer(Long.class, BigNumberSerializer.INSTANCE);
|
||||
javaTimeModule.addSerializer(Long.TYPE, BigNumberSerializer.INSTANCE);
|
||||
javaTimeModule.addSerializer(BigInteger.class, BigNumberSerializer.INSTANCE);
|
||||
javaTimeModule.addSerializer(BigDecimal.class, ToStringSerializer.instance);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(formatter));
|
||||
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter));
|
||||
javaTimeModule.addDeserializer(Date.class, new CustomDateDeserializer());
|
||||
builder.modules(javaTimeModule);
|
||||
builder.timeZone(TimeZone.getDefault());
|
||||
log.info("初始化 jackson 配置");
|
||||
};
|
||||
|
@ -1,9 +1,11 @@
|
||||
package org.dromara.common.json.handler;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
@ -25,7 +27,11 @@ public class CustomDateDeserializer extends JsonDeserializer<Date> {
|
||||
*/
|
||||
@Override
|
||||
public Date deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
return DateUtil.parse(p.getText());
|
||||
DateTime parse = DateUtil.parse(p.getText());
|
||||
if (ObjectUtils.isNull(parse)) {
|
||||
return null;
|
||||
}
|
||||
return parse.toJdkDate();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,11 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.reflect.GenericTypeUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.logging.Log;
|
||||
import org.apache.ibatis.logging.LogFactory;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
@ -132,7 +130,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
|
||||
* @return 查询到的单个VO对象
|
||||
*/
|
||||
default V selectVoById(Serializable id) {
|
||||
return this.selectVoById(id, this.currentVoClass());
|
||||
return selectVoById(id, this.currentVoClass());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,7 +156,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
|
||||
* @return 查询到的VO对象列表
|
||||
*/
|
||||
default List<V> selectVoByIds(Collection<? extends Serializable> idList) {
|
||||
return this.selectVoByIds(idList, this.currentVoClass());
|
||||
return selectVoByIds(idList, this.currentVoClass());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,7 +182,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
|
||||
* @return 查询到的VO对象列表
|
||||
*/
|
||||
default List<V> selectVoByMap(Map<String, Object> map) {
|
||||
return this.selectVoByMap(map, this.currentVoClass());
|
||||
return selectVoByMap(map, this.currentVoClass());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,7 +208,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
|
||||
* @return 查询到的单个VO对象
|
||||
*/
|
||||
default V selectVoOne(Wrapper<T> wrapper) {
|
||||
return this.selectVoOne(wrapper, this.currentVoClass());
|
||||
return selectVoOne(wrapper, this.currentVoClass());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -221,12 +219,11 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
|
||||
* @return 查询到的单个VO对象
|
||||
*/
|
||||
default V selectVoOne(Wrapper<T> wrapper, boolean throwEx) {
|
||||
return this.selectVoOne(wrapper, this.currentVoClass(), throwEx);
|
||||
return selectVoOne(wrapper, this.currentVoClass(), throwEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询单个VO对象,并指定返回的VO对象的类型(自动拼接 limit 1)
|
||||
* 注意不要再自己添加 limit 1 做限制了
|
||||
* 根据条件查询单个VO对象,并指定返回的VO对象的类型
|
||||
*
|
||||
* @param wrapper 查询条件Wrapper
|
||||
* @param voClass 返回的VO对象的Class对象
|
||||
@ -234,12 +231,11 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
|
||||
* @return 查询到的单个VO对象,经过类型转换为指定的VO类后返回
|
||||
*/
|
||||
default <C> C selectVoOne(Wrapper<T> wrapper, Class<C> voClass) {
|
||||
return this.selectVoOne(wrapper, voClass, true);
|
||||
return selectVoOne(wrapper, voClass, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询单个实体对象,并将其转换为指定的VO对象(自动拼接 limit 1)
|
||||
* 注意不要再自己添加 limit 1 做限制了
|
||||
* 根据条件查询单个实体对象,并将其转换为指定的VO对象
|
||||
*
|
||||
* @param wrapper 查询条件Wrapper
|
||||
* @param voClass 要转换的VO类的Class对象
|
||||
@ -255,33 +251,13 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
|
||||
return MapstructUtils.convert(obj, voClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询单条记录(自动拼接 limit 1 限制返回 1 条数据,不依赖 {@code throwEx} 参数)
|
||||
* 注意不要再自己添加 limit 1 做限制了
|
||||
* <p>
|
||||
* <strong>注意:</strong>
|
||||
* 1. 使用 {@code Page<>(1, 1)} 强制分页查询,确保 SQL 自动添加 {@code LIMIT 1},因此 {@code throwEx} 参数不再生效
|
||||
* 2. 原方法的 {@code throwEx} 逻辑(多条数据抛异常)已被优化掉,因为分页查询不会返回多条记录
|
||||
* </p>
|
||||
*
|
||||
* @param queryWrapper 查询条件(可为 null)
|
||||
* @param throwEx <del>是否抛出异常(已弃用,此参数不再生效)</del>
|
||||
* @return 单条记录或无数据时返回 null
|
||||
*/
|
||||
@Override
|
||||
default T selectOne(@Param(Constants.WRAPPER) Wrapper<T> queryWrapper, boolean throwEx) {
|
||||
// 强制分页查询(LIMIT 1),确保最多返回 1 条记录
|
||||
List<T> list = this.selectList(new Page<>(1, 1), queryWrapper);
|
||||
return CollUtil.isEmpty(list) ? null : list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有VO对象列表
|
||||
*
|
||||
* @return 查询到的VO对象列表
|
||||
*/
|
||||
default List<V> selectVoList() {
|
||||
return this.selectVoList(new QueryWrapper<>(), this.currentVoClass());
|
||||
return selectVoList(new QueryWrapper<>(), this.currentVoClass());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -318,7 +294,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
|
||||
* @return 查询到的VO对象分页列表
|
||||
*/
|
||||
default <P extends IPage<V>> P selectVoPage(IPage<T> page, Wrapper<T> wrapper) {
|
||||
return this.selectVoPage(page, wrapper, this.currentVoClass());
|
||||
return selectVoPage(page, wrapper, this.currentVoClass());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,8 @@
|
||||
package org.dromara.common.web.config;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.web.handler.GlobalExceptionHandler;
|
||||
import org.dromara.common.web.interceptor.PlusWebInvokeTimeInterceptor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
@ -34,10 +35,11 @@ public class ResourcesConfig implements WebMvcConfigurer {
|
||||
public void addFormatters(FormatterRegistry registry) {
|
||||
// 全局日期格式转换配置
|
||||
registry.addConverter(String.class, Date.class, source -> {
|
||||
if (StringUtils.isBlank(source)) {
|
||||
DateTime parse = DateUtil.parse(source);
|
||||
if (ObjectUtils.isNull(parse)) {
|
||||
return null;
|
||||
}
|
||||
return DateUtil.parse(source);
|
||||
return parse.toJdkDate();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package org.dromara.common.web.enums;
|
||||
|
||||
import cn.hutool.captcha.generator.CodeGenerator;
|
||||
import cn.hutool.captcha.generator.MathGenerator;
|
||||
import cn.hutool.captcha.generator.RandomGenerator;
|
||||
import org.dromara.common.web.utils.UnsignedMathGenerator;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@ -18,7 +18,7 @@ public enum CaptchaType {
|
||||
/**
|
||||
* 数字
|
||||
*/
|
||||
MATH(UnsignedMathGenerator.class),
|
||||
MATH(MathGenerator.class),
|
||||
|
||||
/**
|
||||
* 字符
|
||||
|
@ -1,88 +0,0 @@
|
||||
package org.dromara.common.web.utils;
|
||||
|
||||
import cn.hutool.captcha.generator.CodeGenerator;
|
||||
import cn.hutool.core.math.Calculator;
|
||||
import cn.hutool.core.util.CharUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 无符号计算生成器
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
public class UnsignedMathGenerator implements CodeGenerator {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -5514819971774091076L;
|
||||
|
||||
private static final String OPERATORS = "+-*";
|
||||
|
||||
/**
|
||||
* 参与计算数字最大长度
|
||||
*/
|
||||
private final int numberLength;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*/
|
||||
public UnsignedMathGenerator() {
|
||||
this(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*
|
||||
* @param numberLength 参与计算最大数字位数
|
||||
*/
|
||||
public UnsignedMathGenerator(int numberLength) {
|
||||
this.numberLength = numberLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generate() {
|
||||
final int limit = getLimit();
|
||||
int a = RandomUtil.randomInt(limit);
|
||||
int b = RandomUtil.randomInt(limit);
|
||||
String max = Integer.toString(Math.max(a,b));
|
||||
String min = Integer.toString(Math.min(a,b));
|
||||
max = StringUtils.rightPad(max, this.numberLength, CharUtil.SPACE);
|
||||
min = StringUtils.rightPad(min, this.numberLength, CharUtil.SPACE);
|
||||
|
||||
return max + RandomUtil.randomChar(OPERATORS) + min + '=';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verify(String code, String userInputCode) {
|
||||
int result;
|
||||
try {
|
||||
result = Integer.parseInt(userInputCode);
|
||||
} catch (NumberFormatException e) {
|
||||
// 用户输入非数字
|
||||
return false;
|
||||
}
|
||||
|
||||
final int calculateResult = (int) Calculator.conversion(code);
|
||||
return result == calculateResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码长度
|
||||
*
|
||||
* @return 验证码长度
|
||||
*/
|
||||
public int getLength() {
|
||||
return this.numberLength * 2 + 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据长度获取参与计算数字最大值
|
||||
*
|
||||
* @return 最大值
|
||||
*/
|
||||
private int getLimit() {
|
||||
return Integer.parseInt("1" + StringUtils.repeat('0', this.numberLength));
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ spring:
|
||||
snail-job:
|
||||
# 服务端节点IP(默认按照`NetUtil.getLocalIpStr()`)
|
||||
server-host:
|
||||
# 服务端netty的端口号
|
||||
# 服务端端口号
|
||||
server-port: 17888
|
||||
# 合并日志默认保存天数
|
||||
merge-Log-days: 1
|
||||
|
@ -18,7 +18,7 @@ spring:
|
||||
snail-job:
|
||||
# 服务端节点IP(默认按照`NetUtil.getLocalIpStr()`)
|
||||
server-host:
|
||||
# 服务端netty的端口号
|
||||
# 服务端端口号
|
||||
server-port: 17888
|
||||
# 合并日志默认保存天数
|
||||
merge-Log-days: 1
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.dromara.demo.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -14,6 +15,7 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -94,6 +96,16 @@ public class TestExcelController {
|
||||
exportExcelService.exportWithOptions(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义导出
|
||||
*
|
||||
* @param response /
|
||||
*/
|
||||
@GetMapping("/customExport")
|
||||
public void customExport(HttpServletResponse response) throws IOException {
|
||||
exportExcelService.customExport(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多个sheet导出
|
||||
*/
|
||||
|
@ -2,6 +2,8 @@ package org.dromara.demo.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 导出下拉框Excel示例
|
||||
*
|
||||
@ -15,4 +17,11 @@ public interface IExportExcelService {
|
||||
* @param response /
|
||||
*/
|
||||
void exportWithOptions(HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 自定义导出
|
||||
*
|
||||
* @param response /
|
||||
*/
|
||||
void customExport(HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
@ -2,17 +2,21 @@ package org.dromara.demo.service.impl;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.idev.excel.write.metadata.WriteSheet;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.SystemConstants;
|
||||
import org.dromara.common.core.utils.StreamUtils;
|
||||
import org.dromara.common.core.utils.file.FileUtils;
|
||||
import org.dromara.common.excel.core.DropDownOptions;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.excel.utils.ExcelWriterWrapper;
|
||||
import org.dromara.demo.domain.vo.ExportDemoVo;
|
||||
import org.dromara.demo.service.IExportExcelService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -233,4 +237,61 @@ public class ExportExcelServiceImpl implements IExportExcelService {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void customExport(HttpServletResponse response) throws IOException {
|
||||
String filename = ExcelUtil.encodingFilename("自定义导出");
|
||||
FileUtils.setAttachmentResponseHeader(response, filename);
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");
|
||||
|
||||
ExcelUtil.exportExcel(ExportDemoVo.class, response.getOutputStream(), wrapper -> {
|
||||
// 创建表格数据,业务中一般通过数据库查询
|
||||
List<ExportDemoVo> excelDataList = new ArrayList<>();
|
||||
for (int i = 0; i < 30; i++) {
|
||||
// 模拟数据库中的一条数据
|
||||
ExportDemoVo everyRowData = new ExportDemoVo();
|
||||
everyRowData.setNickName("用户-" + i);
|
||||
everyRowData.setUserStatus(SystemConstants.NORMAL);
|
||||
everyRowData.setGender("1");
|
||||
everyRowData.setPhoneNumber(String.format("175%08d", i));
|
||||
everyRowData.setEmail(String.format("175%08d", i) + "@163.com");
|
||||
everyRowData.setProvinceId(i);
|
||||
everyRowData.setCityId(i);
|
||||
everyRowData.setAreaId(i);
|
||||
excelDataList.add(everyRowData);
|
||||
}
|
||||
|
||||
// 创建表格
|
||||
WriteSheet sheet = ExcelWriterWrapper.sheetBuilder("自定义导出demo")
|
||||
// 合并单元格
|
||||
// .registerWriteHandler(new CellMergeStrategy(excelDataList, true))
|
||||
.build();
|
||||
|
||||
|
||||
wrapper.write(excelDataList, sheet);
|
||||
|
||||
List<ExportDemoVo> excelDataList2 = new ArrayList<>();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
int index = 1000 + i;
|
||||
// 模拟数据库中的一条数据
|
||||
ExportDemoVo everyRowData = new ExportDemoVo();
|
||||
everyRowData.setNickName("用户-" + index);
|
||||
everyRowData.setUserStatus(SystemConstants.NORMAL);
|
||||
everyRowData.setGender("1");
|
||||
everyRowData.setPhoneNumber(String.format("175%08d", index));
|
||||
everyRowData.setEmail(String.format("175%08d", index) + "@163.com");
|
||||
everyRowData.setProvinceId(index);
|
||||
everyRowData.setCityId(index);
|
||||
everyRowData.setAreaId(index);
|
||||
excelDataList2.add(everyRowData);
|
||||
}
|
||||
|
||||
wrapper.write(excelDataList2, sheet);
|
||||
|
||||
// 或者在同一个excel中创建多个表格
|
||||
// WriteSheet sheet2 = ExcelWriterWrapper.sheetBuilder("自定义导出demo2").build();
|
||||
// wrapper.write(excelDataList2, sheet2);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']" />
|
||||
|
@ -120,7 +120,7 @@
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" />
|
||||
#end
|
||||
#end
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']"></el-button>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${packageName}.mapper.${ClassName}Mapper">
|
||||
|
||||
</mapper>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.dromara.system.controller.system;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -13,8 +14,10 @@ import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.SysDeptBo;
|
||||
import org.dromara.system.domain.bo.SysPostBo;
|
||||
import org.dromara.system.domain.vo.SysPostVo;
|
||||
import org.dromara.system.service.ISysDeptService;
|
||||
import org.dromara.system.service.ISysPostService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -35,6 +38,7 @@ import java.util.List;
|
||||
public class SysPostController extends BaseController {
|
||||
|
||||
private final ISysPostService postService;
|
||||
private final ISysDeptService deptService;
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
@ -134,4 +138,14 @@ public class SysPostController extends BaseController {
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门树列表
|
||||
*/
|
||||
@SaCheckPermission("system:post:list")
|
||||
@GetMapping("/deptTree")
|
||||
public R<List<Tree<Long>>> deptTree(SysDeptBo dept) {
|
||||
return R.ok(deptService.selectDeptTreeList(dept));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,11 @@ public class MetaVo {
|
||||
*/
|
||||
private String link;
|
||||
|
||||
/**
|
||||
* 激活菜单
|
||||
*/
|
||||
private String activeMenu;
|
||||
|
||||
public MetaVo(String title, String icon) {
|
||||
this.title = title;
|
||||
this.icon = icon;
|
||||
@ -58,4 +63,16 @@ public class MetaVo {
|
||||
}
|
||||
}
|
||||
|
||||
public MetaVo(String title, String icon, Boolean noCache, String link, String activeMenu) {
|
||||
this.title = title;
|
||||
this.icon = icon;
|
||||
this.noCache = noCache;
|
||||
if (StringUtils.ishttp(link)) {
|
||||
this.link = link;
|
||||
}
|
||||
if (StringUtils.startWithAnyIgnoreCase(activeMenu, "/")) {
|
||||
this.activeMenu = activeMenu;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,9 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
||||
*/
|
||||
default String buildDeptByRoleSql(Long roleId) {
|
||||
return """
|
||||
select dept_id from sys_role_dept where role_id = %d
|
||||
select srd.dept_id from sys_role_dept srd
|
||||
left join sys_role sr on sr.role_id = srd.role_id
|
||||
where srd.role_id = %d and sr.status = '0'
|
||||
""".formatted(roleId);
|
||||
}
|
||||
|
||||
@ -47,7 +49,9 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
||||
default String buildParentDeptByRoleSql(Long roleId) {
|
||||
return """
|
||||
select parent_id from sys_dept where dept_id in (
|
||||
select dept_id from sys_role_dept where role_id = %d
|
||||
select srd.dept_id from sys_role_dept srd
|
||||
left join sys_role sr on sr.role_id = srd.role_id
|
||||
where srd.role_id = %d and sr.status = '0'
|
||||
)
|
||||
""".formatted(roleId);
|
||||
}
|
||||
|
@ -32,7 +32,9 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
||||
default String buildMenuByUserSql(Long userId) {
|
||||
return """
|
||||
select menu_id from sys_role_menu where role_id in (
|
||||
select role_id from sys_user_role where user_id = %d
|
||||
select sur.role_id from sys_user_role sur
|
||||
left join sys_role sr on sr.role_id = sur.role_id
|
||||
where sur.user_id = %d and sr.status = '0'
|
||||
)
|
||||
""".formatted(userId);
|
||||
}
|
||||
@ -50,7 +52,9 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
||||
*/
|
||||
default String buildMenuByRoleSql(Long roleId) {
|
||||
return """
|
||||
select menu_id from sys_role_menu where role_id = %d
|
||||
select srm.menu_id from sys_role_menu srm
|
||||
left join sys_role sr on sr.role_id = srm.role_id
|
||||
where srm.role_id = %d and sr.status = '0'
|
||||
""".formatted(roleId);
|
||||
}
|
||||
|
||||
@ -68,7 +72,9 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenu, SysMenuVo> {
|
||||
default String buildParentMenuByRoleSql(Long roleId) {
|
||||
return """
|
||||
select parent_id from sys_menu where menu_id in (
|
||||
select menu_id from sys_role_menu where role_id = %d
|
||||
select srm.menu_id from sys_role_menu srm
|
||||
left join sys_role sr on sr.role_id = srm.role_id
|
||||
where srm.role_id = %d and sr.status = '0'
|
||||
)
|
||||
""".formatted(roleId);
|
||||
}
|
||||
|
@ -161,6 +161,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
});
|
||||
}
|
||||
return baseMapper.selectObjs(new LambdaQueryWrapper<SysMenu>()
|
||||
.select(SysMenu::getMenuId)
|
||||
.in(SysMenu::getMenuId, menuIds)
|
||||
.notIn(CollUtil.isNotEmpty(parentIds), SysMenu::getMenuId, parentIds), x -> {
|
||||
return Convert.toLong(x);
|
||||
@ -185,7 +186,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
router.setPath(menu.getRouterPath());
|
||||
router.setComponent(menu.getComponentInfo());
|
||||
router.setQuery(menu.getQueryParam());
|
||||
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
||||
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath(), menu.getRemark()));
|
||||
List<SysMenu> cMenus = menu.getChildren();
|
||||
if (CollUtil.isNotEmpty(cMenus) && SystemConstants.TYPE_DIR.equals(menu.getMenuType())) {
|
||||
router.setAlwaysShow(true);
|
||||
@ -199,7 +200,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
children.setPath(menu.getPath());
|
||||
children.setComponent(menu.getComponent());
|
||||
children.setName(frameName);
|
||||
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
||||
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath(), menu.getRemark()));
|
||||
children.setQuery(menu.getQueryParam());
|
||||
childrenList.add(children);
|
||||
router.setChildren(childrenList);
|
||||
|
@ -0,0 +1,20 @@
|
||||
package org.dromara.workflow.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 抄送设置枚举
|
||||
*
|
||||
* @author AprilWind
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CopySettingEnum implements NodeExtEnum {
|
||||
;
|
||||
private final String label;
|
||||
private final String value;
|
||||
private final boolean selected;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package org.dromara.workflow.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 变量枚举
|
||||
*
|
||||
* @author AprilWind
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum VariablesEnum implements NodeExtEnum {
|
||||
;
|
||||
private final String label;
|
||||
private final String value;
|
||||
private final boolean selected;
|
||||
|
||||
}
|
||||
|
@ -1,46 +0,0 @@
|
||||
package org.dromara.workflow.domain.bo;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.workflow.domain.FlowInstanceBizExt;
|
||||
|
||||
/**
|
||||
* 流程实例业务扩展业务对象 flow_instance_biz_ext
|
||||
*
|
||||
* @author may
|
||||
* @date 2025-08-05
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = FlowInstanceBizExt.class, reverseConvertGenerate = false)
|
||||
public class FlowInstanceBizExtBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 流程实例ID
|
||||
*/
|
||||
private Long instanceId;
|
||||
|
||||
/**
|
||||
* 业务ID
|
||||
*/
|
||||
private String businessId;
|
||||
|
||||
/**
|
||||
* 业务编码
|
||||
*/
|
||||
private String businessCode;
|
||||
|
||||
/**
|
||||
* 业务标题
|
||||
*/
|
||||
private String businessTitle;
|
||||
|
||||
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
package org.dromara.workflow.domain.bo;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.workflow.domain.FlowInstanceBizExt;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@ -47,7 +49,7 @@ public class StartProcessBo implements Serializable {
|
||||
/**
|
||||
* 流程业务扩展信息
|
||||
*/
|
||||
private FlowInstanceBizExtBo flowInstanceBizExtBo;
|
||||
private FlowInstanceBizExt bizExt;
|
||||
|
||||
public Map<String, Object> getVariables() {
|
||||
if (variables == null) {
|
||||
@ -56,4 +58,11 @@ public class StartProcessBo implements Serializable {
|
||||
variables.entrySet().removeIf(entry -> Objects.isNull(entry.getValue()));
|
||||
return variables;
|
||||
}
|
||||
|
||||
public FlowInstanceBizExt getBizExt() {
|
||||
if (ObjectUtil.isNull(bizExt)) {
|
||||
bizExt = new FlowInstanceBizExt();
|
||||
}
|
||||
return bizExt;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package org.dromara.workflow.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 抄送对象
|
||||
*
|
||||
* @author AprilWind
|
||||
*/
|
||||
@Data
|
||||
public class FlowCopyVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "userId")
|
||||
private String userName;
|
||||
|
||||
public FlowCopyVo(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
package org.dromara.workflow.domain.vo;
|
||||
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.workflow.domain.FlowInstanceBizExt;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 流程实例业务扩展视图对象 flow_instance_biz_ext
|
||||
*
|
||||
* @author may
|
||||
* @date 2025-08-05
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = FlowInstanceBizExt.class)
|
||||
public class FlowInstanceBizExtVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 流程实例ID
|
||||
*/
|
||||
@ExcelProperty(value = "流程实例ID")
|
||||
private Long instanceId;
|
||||
|
||||
/**
|
||||
* 业务ID
|
||||
*/
|
||||
@ExcelProperty(value = "业务ID")
|
||||
private String businessId;
|
||||
|
||||
/**
|
||||
* 业务编码
|
||||
*/
|
||||
@ExcelProperty(value = "业务编码")
|
||||
private String businessCode;
|
||||
|
||||
/**
|
||||
* 业务标题
|
||||
*/
|
||||
@ExcelProperty(value = "业务标题")
|
||||
private String businessTitle;
|
||||
|
||||
|
||||
}
|
@ -11,6 +11,7 @@ import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 任务视图
|
||||
@ -185,6 +186,20 @@ public class FlowTaskVo implements Serializable {
|
||||
*/
|
||||
private List<ButtonPermissionVo> buttonList;
|
||||
|
||||
/**
|
||||
* 抄送对象 ID 集合
|
||||
* <p>
|
||||
* 根据扩展属性中 CopySettingEnum 类型的数据生成,存储需要抄送的对象 ID
|
||||
*/
|
||||
private List<FlowCopyVo> copyList;
|
||||
|
||||
/**
|
||||
* 自定义参数 Map
|
||||
* <p>
|
||||
* 根据扩展属性中 VariablesEnum 类型的数据生成,存储 key=value 格式的自定义参数
|
||||
*/
|
||||
private Map<String, String> varList;
|
||||
|
||||
//业务扩展信息开始
|
||||
/**
|
||||
* 业务编码
|
||||
|
@ -0,0 +1,45 @@
|
||||
package org.dromara.workflow.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Node 扩展属性解析结果 VO
|
||||
* <p>
|
||||
* 用于封装从扩展属性 JSON 中解析出的各类信息,包括按钮权限、抄送对象和自定义参数。
|
||||
*
|
||||
* @author AprilWind
|
||||
*/
|
||||
@Data
|
||||
public class NodeExtVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 按钮权限列表
|
||||
* <p>
|
||||
* 根据扩展属性中 ButtonPermissionEnum 类型的数据生成,每个元素表示一个按钮及其是否勾选。
|
||||
*/
|
||||
private List<ButtonPermissionVo> buttonPermissions;
|
||||
|
||||
/**
|
||||
* 抄送对象 ID 集合
|
||||
* <p>
|
||||
* 根据扩展属性中 CopySettingEnum 类型的数据生成,存储需要抄送的对象 ID
|
||||
*/
|
||||
private Set<String> copySettings;
|
||||
|
||||
/**
|
||||
* 自定义参数 Map
|
||||
* <p>
|
||||
* 根据扩展属性中 VariablesEnum 类型的数据生成,存储 key=value 格式的自定义参数
|
||||
*/
|
||||
private Map<String, String> variables;
|
||||
|
||||
}
|
@ -24,7 +24,7 @@ import java.util.Map;
|
||||
public class FlowProcessEventHandler {
|
||||
|
||||
/**
|
||||
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
|
||||
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成等)
|
||||
*
|
||||
* @param flowCode 流程定义编码
|
||||
* @param instance 实例数据
|
||||
|
@ -1,33 +1,39 @@
|
||||
package org.dromara.workflow.listener;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.enums.BusinessStatusEnum;
|
||||
import org.dromara.common.core.service.UserService;
|
||||
import org.dromara.common.core.utils.StreamUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.warm.flow.core.FlowEngine;
|
||||
import org.dromara.warm.flow.core.dto.FlowParams;
|
||||
import org.dromara.warm.flow.core.entity.Definition;
|
||||
import org.dromara.warm.flow.core.entity.Instance;
|
||||
import org.dromara.warm.flow.core.entity.Task;
|
||||
import org.dromara.warm.flow.core.listener.GlobalListener;
|
||||
import org.dromara.warm.flow.core.listener.ListenerVariable;
|
||||
import org.dromara.warm.flow.core.service.InsService;
|
||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||
import org.dromara.workflow.common.constant.FlowConstant;
|
||||
import org.dromara.workflow.common.enums.TaskStatusEnum;
|
||||
import org.dromara.workflow.domain.bo.FlowCopyBo;
|
||||
import org.dromara.workflow.domain.vo.NodeExtVo;
|
||||
import org.dromara.workflow.handler.FlowProcessEventHandler;
|
||||
import org.dromara.workflow.service.IFlwCommonService;
|
||||
import org.dromara.workflow.service.IFlwInstanceService;
|
||||
import org.dromara.workflow.service.IFlwNodeExtService;
|
||||
import org.dromara.workflow.service.IFlwTaskService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 全局任务办理监听
|
||||
@ -41,10 +47,11 @@ import java.util.Map;
|
||||
public class WorkflowGlobalListener implements GlobalListener {
|
||||
|
||||
private final IFlwTaskService flwTaskService;
|
||||
private final IFlwInstanceService instanceService;
|
||||
private final IFlwInstanceService flwInstanceService;
|
||||
private final FlowProcessEventHandler flowProcessEventHandler;
|
||||
private final IFlwCommonService flwCommonService;
|
||||
private final InsService insService;
|
||||
private final IFlwNodeExtService nodeExtService;
|
||||
private final UserService userService;
|
||||
|
||||
/**
|
||||
* 创建监听器,任务创建时执行
|
||||
@ -63,6 +70,25 @@ public class WorkflowGlobalListener implements GlobalListener {
|
||||
*/
|
||||
@Override
|
||||
public void start(ListenerVariable listenerVariable) {
|
||||
String ext = listenerVariable.getNode().getExt();
|
||||
if (StringUtils.isNotBlank(ext)) {
|
||||
NodeExtVo nodeExt = nodeExtService.parseNodeExt(ext);
|
||||
Map<String, Object> variable = listenerVariable.getVariable();
|
||||
Set<String> copyList = nodeExt.getCopySettings();
|
||||
if (CollUtil.isNotEmpty(copyList)) {
|
||||
List<FlowCopyBo> list = StreamUtils.toList(copyList, x -> {
|
||||
FlowCopyBo bo = new FlowCopyBo();
|
||||
Long id = Convert.toLong(x);
|
||||
bo.setUserId(id);
|
||||
bo.setUserName(userService.selectUserNameById(id));
|
||||
return bo;
|
||||
});
|
||||
variable.put(FlowConstant.FLOW_COPY_LIST, list);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(nodeExt.getVariables())) {
|
||||
variable.putAll(nodeExt.getVariables());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,7 +158,7 @@ public class WorkflowGlobalListener implements GlobalListener {
|
||||
flowProcessEventHandler.processHandler(definition.getFlowCode(), instance, BusinessStatusEnum.BACK.getStatus(), params, false);
|
||||
// 修改流程实例状态
|
||||
instance.setFlowStatus(BusinessStatusEnum.BACK.getStatus());
|
||||
insService.updateById(instance);
|
||||
FlowEngine.insService().updateById(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -161,12 +187,9 @@ public class WorkflowGlobalListener implements GlobalListener {
|
||||
if (variable.containsKey(FlowConstant.MESSAGE_TYPE)) {
|
||||
List<String> messageType = MapUtil.get(variable, FlowConstant.MESSAGE_TYPE, new TypeReference<>() {});
|
||||
String notice = MapUtil.getStr(variable, FlowConstant.MESSAGE_NOTICE);
|
||||
// 消息通知
|
||||
if (CollUtil.isNotEmpty(messageType)) {
|
||||
flwCommonService.sendMessage(definition.getFlowName(), instance.getId(), messageType, notice);
|
||||
}
|
||||
flwCommonService.sendMessage(definition.getFlowName(), instance.getId(), messageType, notice);
|
||||
}
|
||||
insService.removeVariables(instance.getId(),
|
||||
FlowEngine.insService().removeVariables(instance.getId(),
|
||||
FlowConstant.FLOW_COPY_LIST,
|
||||
FlowConstant.MESSAGE_TYPE,
|
||||
FlowConstant.MESSAGE_NOTICE,
|
||||
@ -190,7 +213,7 @@ public class WorkflowGlobalListener implements GlobalListener {
|
||||
if (flwTaskService.isTaskEnd(instanceId)) {
|
||||
String status = BusinessStatusEnum.FINISH.getStatus();
|
||||
// 更新流程状态为已完成
|
||||
instanceService.updateStatus(instanceId, status);
|
||||
flwInstanceService.updateStatus(instanceId, status);
|
||||
log.info("流程已结束,状态更新为: {}", status);
|
||||
return status;
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
package org.dromara.workflow.mapper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.workflow.domain.FlowInstanceBizExt;
|
||||
import org.dromara.workflow.domain.vo.FlowInstanceBizExtVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程实例业务扩展Mapper接口
|
||||
@ -10,6 +13,49 @@ import org.dromara.workflow.domain.vo.FlowInstanceBizExtVo;
|
||||
* @author may
|
||||
* @date 2025-08-05
|
||||
*/
|
||||
public interface FlwInstanceBizExtMapper extends BaseMapperPlus<FlowInstanceBizExt, FlowInstanceBizExtVo> {
|
||||
public interface FlwInstanceBizExtMapper extends BaseMapperPlus<FlowInstanceBizExt, FlowInstanceBizExt> {
|
||||
|
||||
/**
|
||||
* 根据 instanceId 保存或更新流程实例业务扩展
|
||||
*
|
||||
* @param entity 流程实例业务扩展实体
|
||||
* @return 操作是否成功
|
||||
*/
|
||||
default int saveOrUpdateByInstanceId(FlowInstanceBizExt entity) {
|
||||
// 查询是否存在
|
||||
FlowInstanceBizExt exist = this.selectOne(new LambdaQueryWrapper<FlowInstanceBizExt>()
|
||||
.eq(FlowInstanceBizExt::getInstanceId, entity.getInstanceId()));
|
||||
|
||||
if (ObjectUtil.isNotNull(exist)) {
|
||||
// 存在就带上主键更新
|
||||
entity.setId(exist.getId());
|
||||
return updateById(entity);
|
||||
} else {
|
||||
// 不存在就插入
|
||||
return insert(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按照流程实例ID删除单个流程实例业务扩展
|
||||
*
|
||||
* @param instanceId 流程实例ID
|
||||
* @return 删除的行数
|
||||
*/
|
||||
default int deleteByInstId(Long instanceId) {
|
||||
return this.delete(new LambdaQueryWrapper<FlowInstanceBizExt>()
|
||||
.eq(FlowInstanceBizExt::getInstanceId, instanceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 按照流程实例ID批量删除流程实例业务扩展
|
||||
*
|
||||
* @param instanceIds 流程实例ID列表
|
||||
* @return 删除的行数
|
||||
*/
|
||||
default int deleteByInstIds(List<Long> instanceIds) {
|
||||
return this.delete(new LambdaQueryWrapper<FlowInstanceBizExt>()
|
||||
.in(FlowInstanceBizExt::getInstanceId, instanceIds));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
package org.dromara.workflow.service;
|
||||
|
||||
import org.dromara.workflow.domain.bo.FlowInstanceBizExtBo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程实例业务扩展Service接口
|
||||
*
|
||||
* @author may
|
||||
* @date 2025-08-05
|
||||
*/
|
||||
public interface IFlwInstanceBizExtService {
|
||||
|
||||
/**
|
||||
* 新增/修改流程实例业务扩展
|
||||
*
|
||||
* @param bo 流程实例业务扩展
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean saveOrUpdate(FlowInstanceBizExtBo bo);
|
||||
|
||||
/**
|
||||
* 按照流程实例ID批量删除
|
||||
*
|
||||
* @param instanceIds 流程实例ID
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteByInstIds(List<Long> instanceIds);
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
package org.dromara.workflow.service;
|
||||
|
||||
import org.dromara.workflow.domain.vo.ButtonPermissionVo;
|
||||
|
||||
import java.util.List;
|
||||
import org.dromara.workflow.domain.vo.NodeExtVo;
|
||||
|
||||
/**
|
||||
* 流程节点扩展属性 服务层
|
||||
@ -12,11 +10,23 @@ import java.util.List;
|
||||
public interface IFlwNodeExtService {
|
||||
|
||||
/**
|
||||
* 从扩展属性构建按钮权限列表:根据 ext 中记录的权限值,标记每个按钮是否勾选
|
||||
* 解析扩展属性 JSON 并构建 Node 扩展属性对象
|
||||
* <p>
|
||||
* 根据传入的 JSON 字符串,将扩展属性分为三类:
|
||||
* 1. ButtonPermissionEnum:解析为按钮权限列表,标记每个按钮是否勾选
|
||||
* 2. CopySettingEnum:解析为抄送对象 ID 集合
|
||||
* 3. VariablesEnum:解析为自定义参数 Map
|
||||
*
|
||||
* <p>示例 JSON:
|
||||
* [
|
||||
* {"code": "ButtonPermissionEnum", "value": "back,termination"},
|
||||
* {"code": "CopySettingEnum", "value": "1"},
|
||||
* {"code": "VariablesEnum", "value": "key1=value1,key2=value2"}
|
||||
* ]
|
||||
*
|
||||
* @param ext 扩展属性 JSON 字符串
|
||||
* @return 按钮权限 VO 列表
|
||||
* @return NodeExtVo 对象,封装按钮权限列表、抄送对象集合和自定义参数 Map
|
||||
*/
|
||||
List<ButtonPermissionVo> buildButtonPermissionsFromExt(String ext);
|
||||
NodeExtVo parseNodeExt(String ext);
|
||||
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import org.dromara.warm.flow.orm.mapper.FlowHisTaskMapper;
|
||||
import org.dromara.warm.flow.ui.service.ChartExtService;
|
||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||
import org.dromara.workflow.common.constant.FlowConstant;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -48,6 +49,8 @@ public class FlwChartExtServiceImpl implements ChartExtService {
|
||||
private final DeptService deptService;
|
||||
private final FlowHisTaskMapper flowHisTaskMapper;
|
||||
private final DictService dictService;
|
||||
@Value("${warm-flow.node-tooltip:true}")
|
||||
private boolean nodeTooltip;
|
||||
|
||||
/**
|
||||
* 设置流程图提示信息
|
||||
@ -56,6 +59,11 @@ public class FlwChartExtServiceImpl implements ChartExtService {
|
||||
*/
|
||||
@Override
|
||||
public void execute(DefJson defJson) {
|
||||
// 配置关闭,直接返回,不渲染悬浮窗
|
||||
if (!nodeTooltip) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据流程实例ID查询所有相关的历史任务列表
|
||||
List<FlowHisTask> flowHisTasks = this.getHisTaskGroupedByNode(defJson.getInstance().getId());
|
||||
if (CollUtil.isEmpty(flowHisTasks)) {
|
||||
@ -103,6 +111,11 @@ public class FlwChartExtServiceImpl implements ChartExtService {
|
||||
*/
|
||||
@Override
|
||||
public void initPromptContent(DefJson defJson) {
|
||||
// 配置关闭,直接返回,不渲染悬浮窗
|
||||
if (!nodeTooltip) {
|
||||
return;
|
||||
}
|
||||
|
||||
defJson.setTopText("流程名称: " + defJson.getFlowName());
|
||||
defJson.getNodeList().forEach(nodeJson -> {
|
||||
nodeJson.setPromptContent(
|
||||
@ -152,8 +165,10 @@ public class FlwChartExtServiceImpl implements ChartExtService {
|
||||
/**
|
||||
* 处理节点的扩展信息,构建用于流程图悬浮提示的内容
|
||||
*
|
||||
* @param nodeJson 当前节点对象
|
||||
* @param taskList 当前节点对应的历史审批任务列表
|
||||
* @param nodeJson 当前流程节点对象,包含节点基础信息和提示内容容器
|
||||
* @param taskList 当前节点关联的历史审批任务列表,用于生成提示信息
|
||||
* @param userMap 用户信息映射表,key 为用户ID,value 为用户DTO对象,用于获取审批人信息
|
||||
* @param dictType 数据字典映射表,key 为字典项编码,value 为对应显示值,用于翻译审批状态等
|
||||
*/
|
||||
private void processNodeExtInfo(NodeJson nodeJson, List<FlowHisTask> taskList, Map<Long, UserDTO> userMap, Map<String, String> dictType) {
|
||||
|
||||
|
@ -11,9 +11,8 @@ import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mail.utils.MailUtils;
|
||||
import org.dromara.common.sse.dto.SseMessageDto;
|
||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||
import org.dromara.warm.flow.core.FlowEngine;
|
||||
import org.dromara.warm.flow.core.entity.Node;
|
||||
import org.dromara.warm.flow.core.enums.SkipType;
|
||||
import org.dromara.warm.flow.core.service.NodeService;
|
||||
import org.dromara.warm.flow.orm.entity.FlowTask;
|
||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||
import org.dromara.workflow.common.enums.MessageTypeEnum;
|
||||
@ -21,8 +20,10 @@ import org.dromara.workflow.service.IFlwCommonService;
|
||||
import org.dromara.workflow.service.IFlwTaskService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
@ -35,19 +36,27 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class FlwCommonServiceImpl implements IFlwCommonService {
|
||||
private final NodeService nodeService;
|
||||
|
||||
private static final String DEFAULT_SUBJECT = "单据审批提醒";
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
* 根据流程实例发送消息给当前处理人
|
||||
*
|
||||
* @param flowName 流程定义名称
|
||||
* @param messageType 消息类型
|
||||
* @param message 消息内容,为空则发送默认配置的消息内容
|
||||
* @param instId 流程实例ID
|
||||
* @param messageType 消息类型列表
|
||||
* @param message 消息内容,为空则使用默认消息
|
||||
*/
|
||||
@Override
|
||||
public void sendMessage(String flowName, Long instId, List<String> messageType, String message) {
|
||||
if (CollUtil.isEmpty(messageType)) {
|
||||
return;
|
||||
}
|
||||
IFlwTaskService flwTaskService = SpringUtils.getBean(IFlwTaskService.class);
|
||||
List<FlowTask> list = flwTaskService.selectByInstId(instId);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isBlank(message)) {
|
||||
message = "有新的【" + flowName + "】单据已经提交至您,请您及时处理。";
|
||||
}
|
||||
@ -55,19 +64,25 @@ public class FlwCommonServiceImpl implements IFlwCommonService {
|
||||
if (CollUtil.isEmpty(userList)) {
|
||||
return;
|
||||
}
|
||||
sendMessage(messageType, message, "单据审批提醒", userList);
|
||||
sendMessage(messageType, message, DEFAULT_SUBJECT, userList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
* 发送消息给指定用户列表
|
||||
*
|
||||
* @param messageType 消息类型
|
||||
* @param messageType 消息类型列表
|
||||
* @param message 消息内容
|
||||
* @param subject 邮件标题
|
||||
* @param userList 接收用户
|
||||
* @param userList 接收用户列表
|
||||
*/
|
||||
@Override
|
||||
public void sendMessage(List<String> messageType, String message, String subject, List<UserDTO> userList) {
|
||||
if (CollUtil.isEmpty(messageType) || CollUtil.isEmpty(userList)) {
|
||||
return;
|
||||
}
|
||||
List<Long> userIds = new ArrayList<>(StreamUtils.toSet(userList, UserDTO::getUserId));
|
||||
Set<String> emails = StreamUtils.toSet(userList, UserDTO::getEmail);
|
||||
|
||||
for (String code : messageType) {
|
||||
MessageTypeEnum messageTypeEnum = MessageTypeEnum.getByCode(code);
|
||||
if (ObjectUtil.isEmpty(messageTypeEnum)) {
|
||||
@ -76,13 +91,11 @@ public class FlwCommonServiceImpl implements IFlwCommonService {
|
||||
switch (messageTypeEnum) {
|
||||
case SYSTEM_MESSAGE -> {
|
||||
SseMessageDto dto = new SseMessageDto();
|
||||
dto.setUserIds(StreamUtils.toList(userList, UserDTO::getUserId).stream().distinct().collect(Collectors.toList()));
|
||||
dto.setUserIds(userIds);
|
||||
dto.setMessage(message);
|
||||
SseMessageUtils.publishMessage(dto);
|
||||
}
|
||||
case EMAIL_MESSAGE -> {
|
||||
MailUtils.sendText(StreamUtils.join(userList, UserDTO::getEmail), subject, message);
|
||||
}
|
||||
case EMAIL_MESSAGE -> MailUtils.sendText(emails, subject, message);
|
||||
case SMS_MESSAGE -> {
|
||||
//todo 短信发送
|
||||
}
|
||||
@ -100,8 +113,7 @@ public class FlwCommonServiceImpl implements IFlwCommonService {
|
||||
*/
|
||||
@Override
|
||||
public String applyNodeCode(Long definitionId) {
|
||||
Node startNode = nodeService.getStartNode(definitionId);
|
||||
Node nextNode = nodeService.getNextNode(definitionId, startNode.getNodeCode(), null, SkipType.PASS.getKey());
|
||||
return nextNode.getNodeCode();
|
||||
List<Node> firstBetweenNode = FlowEngine.nodeService().getFirstBetweenNode(definitionId, new HashMap<>());
|
||||
return firstBetweenNode.get(0).getNodeCode();
|
||||
}
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
package org.dromara.workflow.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.workflow.domain.FlowInstanceBizExt;
|
||||
import org.dromara.workflow.domain.bo.FlowInstanceBizExtBo;
|
||||
import org.dromara.workflow.mapper.FlwInstanceBizExtMapper;
|
||||
import org.dromara.workflow.service.IFlwInstanceBizExtService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程实例业务扩展Service业务层处理
|
||||
*
|
||||
* @author may
|
||||
* @date 2025-08-05
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class FlwInstanceBizExtServiceImpl implements IFlwInstanceBizExtService {
|
||||
|
||||
private final FlwInstanceBizExtMapper baseMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 新增/修改流程实例业务扩展
|
||||
*
|
||||
* @param bo 流程实例业务扩展
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean saveOrUpdate(FlowInstanceBizExtBo bo) {
|
||||
FlowInstanceBizExt convert = MapstructUtils.convert(bo, FlowInstanceBizExt.class);
|
||||
FlowInstanceBizExt flowInstanceBizExt = baseMapper.selectOne(new LambdaQueryWrapper<FlowInstanceBizExt>()
|
||||
.eq(FlowInstanceBizExt::getInstanceId, bo.getInstanceId()));
|
||||
if (flowInstanceBizExt != null) {
|
||||
flowInstanceBizExt.setBusinessTitle(convert.getBusinessTitle());
|
||||
return baseMapper.insertOrUpdate(flowInstanceBizExt);
|
||||
}
|
||||
return baseMapper.insertOrUpdate(convert);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按照流程实例ID批量删除
|
||||
*
|
||||
* @param instanceIds 流程实例ID
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteByInstIds(List<Long> instanceIds) {
|
||||
return baseMapper.delete(new LambdaQueryWrapper<FlowInstanceBizExt>().in(FlowInstanceBizExt::getInstanceId, instanceIds)) > 0;
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package org.dromara.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.domain.dto.DictTypeDTO;
|
||||
@ -13,14 +13,16 @@ import org.dromara.warm.flow.ui.service.NodeExtService;
|
||||
import org.dromara.warm.flow.ui.vo.NodeExt;
|
||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||
import org.dromara.workflow.common.enums.ButtonPermissionEnum;
|
||||
import org.dromara.workflow.common.enums.CopySettingEnum;
|
||||
import org.dromara.workflow.common.enums.NodeExtEnum;
|
||||
import org.dromara.workflow.common.enums.VariablesEnum;
|
||||
import org.dromara.workflow.domain.vo.ButtonPermissionVo;
|
||||
import org.dromara.workflow.domain.vo.NodeExtVo;
|
||||
import org.dromara.workflow.service.IFlwNodeExtService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 流程设计器-节点扩展属性
|
||||
@ -36,14 +38,35 @@ public class FlwNodeExtServiceImpl implements NodeExtService, IFlwNodeExtService
|
||||
/**
|
||||
* 存储不同 dictType 对应的配置信息
|
||||
*/
|
||||
private static final Map<String, ButtonPermission> CHILD_NODE_MAP = new HashMap<>();
|
||||
|
||||
record ButtonPermission(String label, Integer type, Boolean must, Boolean multiple) {
|
||||
}
|
||||
private static final Map<String, Map<String, Object>> CHILD_NODE_MAP;
|
||||
|
||||
static {
|
||||
CHILD_NODE_MAP.put(ButtonPermissionEnum.class.getSimpleName(),
|
||||
new ButtonPermission("权限按钮", 4, false, true));
|
||||
CHILD_NODE_MAP = Map.of(
|
||||
CopySettingEnum.class.getSimpleName(),
|
||||
Map.of(
|
||||
"label", "抄送对象",
|
||||
"type", 2,
|
||||
"must", false,
|
||||
"multiple", false,
|
||||
"desc", "设置该节点的抄送办理人"
|
||||
),
|
||||
VariablesEnum.class.getSimpleName(),
|
||||
Map.of(
|
||||
"label", "自定义参数",
|
||||
"type", 2,
|
||||
"must", false,
|
||||
"multiple", false,
|
||||
"desc", "节点执行时可以使用的自定义参数"
|
||||
),
|
||||
ButtonPermissionEnum.class.getSimpleName(),
|
||||
Map.of(
|
||||
"label", "权限按钮",
|
||||
"type", 4,
|
||||
"must", false,
|
||||
"multiple", true,
|
||||
"desc", "控制该节点的按钮权限"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private final DictService dictService;
|
||||
@ -56,6 +79,9 @@ public class FlwNodeExtServiceImpl implements NodeExtService, IFlwNodeExtService
|
||||
@Override
|
||||
public List<NodeExt> getNodeExt() {
|
||||
List<NodeExt> nodeExtList = new ArrayList<>();
|
||||
// 构建基础设置页面
|
||||
nodeExtList.add(buildNodeExt("wf_basic_tab", "基础设置", 1,
|
||||
List.of(CopySettingEnum.class, VariablesEnum.class)));
|
||||
// 构建按钮权限页面
|
||||
nodeExtList.add(buildNodeExt("wf_button_tab", "权限", 2,
|
||||
List.of(ButtonPermissionEnum.class)));
|
||||
@ -105,9 +131,20 @@ public class FlwNodeExtServiceImpl implements NodeExtService, IFlwNodeExtService
|
||||
return null;
|
||||
}
|
||||
String simpleName = enumClass.getSimpleName();
|
||||
NodeExt.ChildNode childNode = buildChildNodeMap(simpleName);
|
||||
NodeExt.ChildNode childNode = new NodeExt.ChildNode();
|
||||
Map<String, Object> map = CHILD_NODE_MAP.get(simpleName);
|
||||
// 编码,此json中唯
|
||||
childNode.setCode(simpleName);
|
||||
// label名称
|
||||
childNode.setLabel(Convert.toStr(map.get("label")));
|
||||
// 1:输入框 2:文本域 3:下拉框 4:选择框
|
||||
childNode.setType(Convert.toInt(map.get("type"), 1));
|
||||
// 是否必填
|
||||
childNode.setMust(Convert.toBool(map.get("must"), false));
|
||||
// 是否多选
|
||||
childNode.setMultiple(Convert.toBool(map.get("multiple"), true));
|
||||
// 描述
|
||||
childNode.setDesc(Convert.toStr(map.get("desc"), null));
|
||||
// 字典,下拉框和复选框时用到
|
||||
childNode.setDict(Arrays.stream(enumClass.getEnumConstants())
|
||||
.map(NodeExtEnum.class::cast)
|
||||
@ -128,12 +165,18 @@ public class FlwNodeExtServiceImpl implements NodeExtService, IFlwNodeExtService
|
||||
if (ObjectUtil.isNull(dictTypeDTO)) {
|
||||
return null;
|
||||
}
|
||||
NodeExt.ChildNode childNode = buildChildNodeMap(dictType);
|
||||
NodeExt.ChildNode childNode = new NodeExt.ChildNode();
|
||||
// 编码,此json中唯一
|
||||
childNode.setCode(dictType);
|
||||
// label名称
|
||||
childNode.setLabel(dictTypeDTO.getDictName());
|
||||
// 描述
|
||||
// 1:输入框 2:文本域 3:下拉框 4:选择框
|
||||
childNode.setType(3);
|
||||
// 是否必填
|
||||
childNode.setMust(false);
|
||||
// 是否多选
|
||||
childNode.setMultiple(true);
|
||||
// 描述 (可根据描述参数解析更多配置,如type,must,multiple等)
|
||||
childNode.setDesc(dictTypeDTO.getRemark());
|
||||
// 字典,下拉框和复选框时用到
|
||||
childNode.setDict(dictService.getDictData(dictType)
|
||||
@ -144,100 +187,71 @@ public class FlwNodeExtServiceImpl implements NodeExtService, IFlwNodeExtService
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 CHILD_NODE_MAP 中的配置信息,构建一个基本的 ChildNode 对象
|
||||
* 该方法用于设置 ChildNode 的常规属性,例如 label、type、是否必填、是否多选等
|
||||
* 解析扩展属性 JSON 并构建 Node 扩展属性对象
|
||||
* <p>
|
||||
* 根据传入的 JSON 字符串,将扩展属性分为三类:
|
||||
* 1. ButtonPermissionEnum:解析为按钮权限列表,标记每个按钮是否勾选
|
||||
* 2. CopySettingEnum:解析为抄送对象 ID 集合
|
||||
* 3. VariablesEnum:解析为自定义参数 Map
|
||||
*
|
||||
* @param key CHILD_NODE_MAP 的 key
|
||||
* @return 返回构建好的 ChildNode 对象
|
||||
*/
|
||||
private NodeExt.ChildNode buildChildNodeMap(String key) {
|
||||
NodeExt.ChildNode childNode = new NodeExt.ChildNode();
|
||||
ButtonPermission bp = CHILD_NODE_MAP.get(key);
|
||||
if (bp == null) {
|
||||
childNode.setType(1);
|
||||
childNode.setMust(false);
|
||||
childNode.setMultiple(true);
|
||||
return childNode;
|
||||
}
|
||||
// label名称
|
||||
childNode.setLabel(bp.label());
|
||||
// 1:输入框 2:输入框 3:下拉框 4:选择框
|
||||
childNode.setType(bp.type());
|
||||
// 是否必填
|
||||
childNode.setMust(bp.must());
|
||||
// 是否多选
|
||||
childNode.setMultiple(bp.multiple());
|
||||
return childNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从扩展属性构建按钮权限列表:根据 ext 中记录的权限值,标记每个按钮是否勾选
|
||||
* <p>示例 JSON:
|
||||
* [
|
||||
* {"code": "ButtonPermissionEnum", "value": "back,termination"},
|
||||
* {"code": "CopySettingEnum", "value": "1"},
|
||||
* {"code": "VariablesEnum", "value": "key1=value1,key2=value2"}
|
||||
* ]
|
||||
*
|
||||
* @param ext 扩展属性 JSON 字符串
|
||||
* @return 按钮权限 VO 列表
|
||||
* @return NodeExtVo 对象,封装按钮权限列表、抄送对象集合和自定义参数 Map
|
||||
*/
|
||||
@Override
|
||||
public List<ButtonPermissionVo> buildButtonPermissionsFromExt(String ext) {
|
||||
// 解析 ext 为 Map<code, Set<value>>,用于标记权限
|
||||
Map<String, Set<String>> permissionMap = JsonUtils.parseArray(ext, ButtonPermissionVo.class)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(
|
||||
ButtonPermissionVo::getCode,
|
||||
item -> StringUtils.splitList(item.getValue()).stream()
|
||||
.map(String::trim)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.collect(Collectors.toSet()),
|
||||
(a, b) -> b,
|
||||
HashMap::new
|
||||
));
|
||||
public NodeExtVo parseNodeExt(String ext) {
|
||||
NodeExtVo nodeExtVo = new NodeExtVo();
|
||||
|
||||
// 构建按钮权限列表,标记哪些按钮在 permissionMap 中出现(表示已勾选)
|
||||
return buildPermissionsFromSources(permissionMap, List.of(ButtonPermissionEnum.class));
|
||||
}
|
||||
// 解析 JSON 为 Dict 列表
|
||||
List<Dict> nodeExtMap = JsonUtils.parseArrayMap(ext);
|
||||
|
||||
/**
|
||||
* 将权限映射与按钮权限来源(枚举类或字典类型)进行匹配,生成权限视图列表
|
||||
* <p>
|
||||
* 使用说明:
|
||||
* - sources 支持传入多个来源类型,支持 NodeExtEnum 枚举类 或 字典类型字符串(dictType)
|
||||
* - 若需要扩展更多按钮权限,只需在 sources 中新增对应的枚举类或字典类型
|
||||
* <p>
|
||||
* 示例:
|
||||
* buildPermissionsFromSources(permissionMap, List.of(ButtonPermissionEnum.class, "custom_button_dict"));
|
||||
*
|
||||
* @param permissionMap 权限映射
|
||||
* @param sources 枚举类或字典类型列表
|
||||
* @return 按钮权限视图对象列表
|
||||
*/
|
||||
@SuppressWarnings("unchecked cast")
|
||||
private List<ButtonPermissionVo> buildPermissionsFromSources(Map<String, Set<String>> permissionMap, List<Object> sources) {
|
||||
return sources.stream()
|
||||
.flatMap(source -> {
|
||||
if (source instanceof Class<?> clazz && NodeExtEnum.class.isAssignableFrom(clazz)) {
|
||||
Set<String> selectedSet = permissionMap.getOrDefault(clazz.getSimpleName(), Collections.emptySet());
|
||||
return extractDictItems(this.buildChildNode((Class<? extends NodeExtEnum>) clazz), selectedSet).stream();
|
||||
} else if (source instanceof String dictType) {
|
||||
Set<String> selectedSet = permissionMap.getOrDefault(dictType, Collections.emptySet());
|
||||
return extractDictItems(this.buildChildNode(dictType), selectedSet).stream();
|
||||
}
|
||||
return Stream.empty();
|
||||
}).toList();
|
||||
}
|
||||
for (Dict nodeExt : nodeExtMap) {
|
||||
String code = nodeExt.getStr("code");
|
||||
String value = nodeExt.getStr("value");
|
||||
|
||||
/**
|
||||
* 从节点子项中提取字典项,并构建按钮权限视图对象列表
|
||||
*
|
||||
* @param childNode 子节点
|
||||
* @param selectedSet 已选中的值集
|
||||
* @return 按钮权限视图对象列表
|
||||
*/
|
||||
private List<ButtonPermissionVo> extractDictItems(NodeExt.ChildNode childNode, Set<String> selectedSet) {
|
||||
return Optional.ofNullable(childNode)
|
||||
.map(NodeExt.ChildNode::getDict)
|
||||
.orElse(List.of())
|
||||
.stream()
|
||||
.map(dict -> new ButtonPermissionVo(dict.getValue(), selectedSet.contains(dict.getValue())))
|
||||
.toList();
|
||||
if (ButtonPermissionEnum.class.getSimpleName().equals(code)) {
|
||||
// 解析按钮权限
|
||||
// 将 value 拆分为 Set<String>,便于精确匹配
|
||||
Set<String> buttonSet = StringUtils.str2Set(value, StringUtils.SEPARATOR);
|
||||
|
||||
// 获取按钮字典配置
|
||||
NodeExt.ChildNode childNode = buildChildNode(ButtonPermissionEnum.class);
|
||||
|
||||
// 构建 ButtonPermissionVo 列表
|
||||
List<ButtonPermissionVo> buttonList = Optional.ofNullable(childNode)
|
||||
.map(NodeExt.ChildNode::getDict)
|
||||
.orElse(List.of())
|
||||
.stream()
|
||||
.map(dict -> new ButtonPermissionVo(dict.getValue(), buttonSet.contains(dict.getValue())))
|
||||
.toList();
|
||||
|
||||
nodeExtVo.setButtonPermissions(buttonList);
|
||||
|
||||
} else if (CopySettingEnum.class.getSimpleName().equals(code)) {
|
||||
// 解析抄送对象 ID 集合
|
||||
nodeExtVo.setCopySettings(StringUtils.str2Set(value, StringUtils.SEPARATOR));
|
||||
|
||||
} else if (VariablesEnum.class.getSimpleName().equals(code)) {
|
||||
// 解析自定义参数
|
||||
// 将 key=value 字符串拆分为 Map
|
||||
Map<String, String> variables = Arrays.stream(StringUtils.split(value, StringUtils.SEPARATOR))
|
||||
.map(s -> StringUtils.split(s, "="))
|
||||
.filter(arr -> arr.length == 2)
|
||||
.collect(Collectors.toMap(arr -> arr[0], arr -> arr[1]));
|
||||
|
||||
nodeExtVo.setVariables(variables);
|
||||
} else {
|
||||
// 未知扩展类型,记录日志
|
||||
log.warn("未知扩展类型:code={}, value={}", code, value);
|
||||
}
|
||||
}
|
||||
return nodeExtVo;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||
@ -37,17 +36,27 @@ import org.dromara.warm.flow.core.service.*;
|
||||
import org.dromara.warm.flow.core.utils.ExpressionUtil;
|
||||
import org.dromara.warm.flow.core.utils.MapUtil;
|
||||
import org.dromara.warm.flow.orm.entity.*;
|
||||
import org.dromara.warm.flow.orm.mapper.*;
|
||||
import org.dromara.warm.flow.orm.mapper.FlowHisTaskMapper;
|
||||
import org.dromara.warm.flow.orm.mapper.FlowInstanceMapper;
|
||||
import org.dromara.warm.flow.orm.mapper.FlowNodeMapper;
|
||||
import org.dromara.warm.flow.orm.mapper.FlowTaskMapper;
|
||||
import org.dromara.workflow.common.ConditionalOnEnable;
|
||||
import org.dromara.workflow.common.constant.FlowConstant;
|
||||
import org.dromara.workflow.common.enums.TaskAssigneeType;
|
||||
import org.dromara.workflow.common.enums.TaskStatusEnum;
|
||||
import org.dromara.workflow.domain.FlowInstanceBizExt;
|
||||
import org.dromara.workflow.domain.bo.*;
|
||||
import org.dromara.workflow.domain.vo.FlowCopyVo;
|
||||
import org.dromara.workflow.domain.vo.FlowHisTaskVo;
|
||||
import org.dromara.workflow.domain.vo.FlowTaskVo;
|
||||
import org.dromara.workflow.domain.vo.NodeExtVo;
|
||||
import org.dromara.workflow.mapper.FlwCategoryMapper;
|
||||
import org.dromara.workflow.mapper.FlwInstanceBizExtMapper;
|
||||
import org.dromara.workflow.mapper.FlwTaskMapper;
|
||||
import org.dromara.workflow.service.*;
|
||||
import org.dromara.workflow.service.IFlwCommonService;
|
||||
import org.dromara.workflow.service.IFlwNodeExtService;
|
||||
import org.dromara.workflow.service.IFlwTaskAssigneeService;
|
||||
import org.dromara.workflow.service.IFlwTaskService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -83,7 +92,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
private final IFlwTaskAssigneeService flwTaskAssigneeService;
|
||||
private final IFlwCommonService flwCommonService;
|
||||
private final IFlwNodeExtService flwNodeExtService;
|
||||
private final IFlwInstanceBizExtService flowInstanceBizExtService;
|
||||
private final FlwInstanceBizExtMapper flwInstanceBizExtMapper;
|
||||
|
||||
/**
|
||||
* 启动任务
|
||||
@ -97,6 +106,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
if (StringUtils.isBlank(businessId)) {
|
||||
throw new ServiceException("启动工作流时必须包含业务ID");
|
||||
}
|
||||
|
||||
// 启动流程实例(提交申请)
|
||||
Map<String, Object> variables = startProcessBo.getVariables();
|
||||
// 流程发起人
|
||||
@ -105,14 +115,14 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
variables.put(INITIATOR_DEPT_ID, LoginHelper.getDeptId());
|
||||
// 业务id
|
||||
variables.put(BUSINESS_ID, businessId);
|
||||
FlowInstanceBizExt bizExt = startProcessBo.getBizExt();
|
||||
|
||||
// 获取已有流程实例
|
||||
FlowInstance flowInstance = flowInstanceMapper.selectOne(new LambdaQueryWrapper<>(FlowInstance.class)
|
||||
.eq(FlowInstance::getBusinessId, businessId));
|
||||
FlowInstanceBizExtBo extBo = startProcessBo.getFlowInstanceBizExtBo();
|
||||
if (ObjectUtil.isEmpty(extBo)) {
|
||||
extBo = new FlowInstanceBizExtBo();
|
||||
startProcessBo.setFlowInstanceBizExtBo(extBo);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotNull(flowInstance)) {
|
||||
// 已存在流程
|
||||
BusinessStatusEnum.checkStartStatus(flowInstance.getFlowStatus());
|
||||
List<Task> taskList = taskService.list(new FlowTask().setInstanceId(flowInstance.getId()));
|
||||
taskService.mergeVariable(flowInstance, variables);
|
||||
@ -121,24 +131,16 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
dto.setProcessInstanceId(taskList.get(0).getInstanceId());
|
||||
dto.setTaskId(taskList.get(0).getId());
|
||||
// 保存流程实例业务信息
|
||||
buildFlowInstanceBizExt(flowInstance, startProcessBo.getFlowInstanceBizExtBo());
|
||||
this.buildFlowInstanceBizExt(flowInstance, bizExt);
|
||||
return dto;
|
||||
}
|
||||
String businessCode;
|
||||
// 生成业务编号
|
||||
if (StringUtils.isBlank(extBo.getBusinessCode())) {
|
||||
//todo 按照自己业务自行修改
|
||||
businessCode = System.currentTimeMillis()+ StrUtil.EMPTY;
|
||||
extBo.setBusinessCode(businessCode);
|
||||
} else {
|
||||
businessCode = extBo.getBusinessCode();
|
||||
}
|
||||
|
||||
// 将流程定义内的扩展参数设置到变量中
|
||||
Definition definition = FlowEngine.defService().getPublishByFlowCode(startProcessBo.getFlowCode());
|
||||
Dict dict = JsonUtils.parseMap(definition.getExt());
|
||||
boolean autoPass = !ObjectUtil.isNull(dict) && dict.getBool(FlowConstant.AUTO_PASS);
|
||||
variables.put(FlowConstant.AUTO_PASS, autoPass);
|
||||
variables.put(FlowConstant.BUSINESS_CODE, businessCode);
|
||||
variables.put(FlowConstant.BUSINESS_CODE, this.generateBusinessCode(bizExt));
|
||||
FlowParams flowParams = FlowParams.build()
|
||||
.handler(startProcessBo.getHandler())
|
||||
.flowCode(startProcessBo.getFlowCode())
|
||||
@ -151,7 +153,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
// 保存流程实例业务信息
|
||||
buildFlowInstanceBizExt(instance, startProcessBo.getFlowInstanceBizExtBo());
|
||||
this.buildFlowInstanceBizExt(instance, bizExt);
|
||||
// 申请人执行流程
|
||||
List<Task> taskList = taskService.list(new FlowTask().setInstanceId(instance.getId()));
|
||||
if (taskList.size() > 1) {
|
||||
@ -163,17 +165,29 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成业务编号,如果已有则直接返回已有值
|
||||
*/
|
||||
private String generateBusinessCode(FlowInstanceBizExt bizExt) {
|
||||
if (StringUtils.isBlank(bizExt.getBusinessCode())) {
|
||||
// TODO: 按照自己业务规则生成编号
|
||||
String businessCode = Convert.toStr(System.currentTimeMillis());
|
||||
bizExt.setBusinessCode(businessCode);
|
||||
return businessCode;
|
||||
}
|
||||
return bizExt.getBusinessCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建流程实例业务信息
|
||||
*
|
||||
* @param instance 流程实例
|
||||
* @param flowInstanceBizExtBo 业务扩展信息
|
||||
* @param instance 流程实例
|
||||
* @param bizExt 流程业务扩展信息
|
||||
*/
|
||||
private void buildFlowInstanceBizExt(Instance instance, FlowInstanceBizExtBo flowInstanceBizExtBo) {
|
||||
flowInstanceBizExtBo.setInstanceId(instance.getId());
|
||||
flowInstanceBizExtBo.setBusinessId(instance.getBusinessId());
|
||||
flowInstanceBizExtBo.setBusinessCode(flowInstanceBizExtBo.getBusinessCode());
|
||||
flowInstanceBizExtService.saveOrUpdate(flowInstanceBizExtBo);
|
||||
private void buildFlowInstanceBizExt(Instance instance, FlowInstanceBizExt bizExt) {
|
||||
bizExt.setInstanceId(instance.getId());
|
||||
bizExt.setBusinessId(instance.getBusinessId());
|
||||
flwInstanceBizExtMapper.saveOrUpdateByInstanceId(bizExt);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -235,10 +249,10 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
/**
|
||||
* 流程办理
|
||||
*
|
||||
* @param taskId 任务ID
|
||||
* @param flowParams 参数
|
||||
* @param instanceId 实例ID
|
||||
* @param autoPass 自动审批
|
||||
* @param taskId 任务ID
|
||||
* @param flowParams 参数
|
||||
* @param instanceId 实例ID
|
||||
* @param autoPass 自动审批
|
||||
*/
|
||||
private void skipTask(Long taskId, FlowParams flowParams, Long instanceId, Boolean autoPass) {
|
||||
// 执行任务跳转,并根据返回的处理人设置下一步处理人
|
||||
@ -494,8 +508,8 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
/**
|
||||
* 获取可驳回的前置节点
|
||||
*
|
||||
* @param taskId 任务id
|
||||
* @param nowNodeCode 当前节点
|
||||
* @param taskId 任务id
|
||||
* @param nowNodeCode 当前节点
|
||||
*/
|
||||
@Override
|
||||
public List<Node> getBackTaskNode(Long taskId, String nowNodeCode) {
|
||||
@ -585,8 +599,16 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
if (ObjectUtil.isNull(flowNode)) {
|
||||
throw new NullPointerException("当前【" + flowTaskVo.getNodeCode() + "】节点编码不存在");
|
||||
}
|
||||
NodeExtVo nodeExtVo = flwNodeExtService.parseNodeExt(flowNode.getExt());
|
||||
//设置按钮权限
|
||||
flowTaskVo.setButtonList(flwNodeExtService.buildButtonPermissionsFromExt(flowNode.getExt()));
|
||||
flowTaskVo.setButtonList(nodeExtVo.getButtonPermissions());
|
||||
if (CollUtil.isNotEmpty(nodeExtVo.getCopySettings())) {
|
||||
List<FlowCopyVo> list = StreamUtils.toList(nodeExtVo.getCopySettings(), x -> new FlowCopyVo(Convert.toLong(x)));
|
||||
flowTaskVo.setCopyList(list);
|
||||
} else {
|
||||
flowTaskVo.setCopyList(new ArrayList<>());
|
||||
}
|
||||
flowTaskVo.setVarList(nodeExtVo.getVariables());
|
||||
flowTaskVo.setNodeRatio(flowNode.getNodeRatio());
|
||||
flowTaskVo.setApplyNode(flowNode.getNodeCode().equals(flwCommonService.applyNodeCode(task.getDefinitionId())));
|
||||
return flowTaskVo;
|
||||
@ -616,14 +638,14 @@ public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||
//办理人变量替换
|
||||
ExpressionUtil.evalVariable(buildNextTaskList, FlowParams.build().variable(mergeVariable));
|
||||
for (FlowNode flowNode : nextFlowNodes) {
|
||||
Task first = StreamUtils.findFirst(buildNextTaskList, t -> t.getNodeCode().equals(flowNode.getNodeCode()));
|
||||
if (ObjectUtil.isNotNull(first) && CollUtil.isNotEmpty(first.getPermissionList())) {
|
||||
List<UserDTO> users = flwTaskAssigneeService.fetchUsersByStorageIds(StringUtils.joinComma(first.getPermissionList()));
|
||||
if (CollUtil.isNotEmpty(users)) {
|
||||
flowNode.setPermissionFlag(StreamUtils.join(users, e -> Convert.toStr(e.getUserId())));
|
||||
}
|
||||
}
|
||||
|
||||
StreamUtils.findFirst(buildNextTaskList, t -> t.getNodeCode().equals(flowNode.getNodeCode()))
|
||||
.ifPresent(first -> {
|
||||
List<UserDTO> users;
|
||||
if (CollUtil.isNotEmpty(first.getPermissionList())
|
||||
&& CollUtil.isNotEmpty(users = flwTaskAssigneeService.fetchUsersByStorageIds(StringUtils.joinComma(first.getPermissionList())))) {
|
||||
flowNode.setPermissionFlag(StreamUtils.join(users, e -> Convert.toStr(e.getUserId())));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return nextFlowNodes;
|
||||
|
@ -99,7 +99,7 @@ services:
|
||||
network_mode: "host"
|
||||
|
||||
ruoyi-server1:
|
||||
image: ruoyi/ruoyi-server:5.4.1
|
||||
image: ruoyi/ruoyi-server:5.5.0
|
||||
container_name: ruoyi-server1
|
||||
environment:
|
||||
# 时区上海
|
||||
@ -115,7 +115,7 @@ services:
|
||||
network_mode: "host"
|
||||
|
||||
ruoyi-server2:
|
||||
image: ruoyi/ruoyi-server:5.4.1
|
||||
image: ruoyi/ruoyi-server:5.5.0
|
||||
container_name: ruoyi-server2
|
||||
environment:
|
||||
# 时区上海
|
||||
@ -131,7 +131,7 @@ services:
|
||||
network_mode: "host"
|
||||
|
||||
ruoyi-monitor-admin:
|
||||
image: ruoyi/ruoyi-monitor-admin:5.4.1
|
||||
image: ruoyi/ruoyi-monitor-admin:5.5.0
|
||||
container_name: ruoyi-monitor-admin
|
||||
environment:
|
||||
# 时区上海
|
||||
@ -143,7 +143,7 @@ services:
|
||||
network_mode: "host"
|
||||
|
||||
ruoyi-snailjob-server:
|
||||
image: ruoyi/ruoyi-snailjob-server:5.4.1
|
||||
image: ruoyi/ruoyi-snailjob-server:5.5.0
|
||||
container_name: ruoyi-snailjob-server
|
||||
environment:
|
||||
# 时区上海
|
||||
|
@ -447,11 +447,11 @@ insert into sys_menu values('115', '代码生成', '3', '2', 'gen',
|
||||
insert into sys_menu values('121', '租户管理', '6', '1', 'tenant', 'system/tenant/index', '', 1, 0, 'C', '0', '0', 'system:tenant:list', 'list', 103, 1, sysdate, null, null, '租户管理菜单');
|
||||
insert into sys_menu values('122', '租户套餐管理', '6', '2', 'tenantPackage', 'system/tenantPackage/index', '', 1, 0, 'C', '0', '0', 'system:tenantPackage:list', 'form', 103, 1, sysdate, null, null, '租户套餐管理菜单');
|
||||
insert into sys_menu values('123', '客户端管理', '1', '11', 'client', 'system/client/index', '', 1, 0, 'C', '0', '0', 'system:client:list', 'international', 103, 1, sysdate, null, null, '客户端管理菜单');
|
||||
insert into sys_menu values('116', '修改生成配置', '3', '2', 'gen-edit/index/:tableId', 'tool/gen/editTable', '', 1, 1, 'C', '1', '0', 'tool:gen:edit', '#', 103, 1, sysdate, null, null, '');
|
||||
insert into sys_menu values('130', '分配用户', '1', '2', 'role-auth/user/:roleId', 'system/role/authUser', '', 1, 1, 'C', '1', '0', 'system:role:edit', '#', 103, 1, sysdate, null, null, '');
|
||||
insert into sys_menu values('131', '分配角色', '1', '1', 'user-auth/role/:userId', 'system/user/authRole', '', 1, 1, 'C', '1', '0', 'system:user:edit', '#', 103, 1, sysdate, null, null, '');
|
||||
insert into sys_menu values('132', '字典数据', '1', '6', 'dict-data/index/:dictId', 'system/dict/data', '', 1, 1, 'C', '1', '0', 'system:dict:list', '#', 103, 1, sysdate, null, null, '');
|
||||
insert into sys_menu values('133', '文件配置管理', '1', '10', 'oss-config/index', 'system/oss/config', '', 1, 1, 'C', '1', '0', 'system:ossConfig:list', '#', 103, 1, sysdate, null, null, '');
|
||||
insert into sys_menu values('116', '修改生成配置', '3', '2', 'gen-edit/index/:tableId', 'tool/gen/editTable', '', 1, 1, 'C', '1', '0', 'tool:gen:edit', '#', 103, 1, sysdate, null, null, '/tool/gen');
|
||||
insert into sys_menu values('130', '分配用户', '1', '2', 'role-auth/user/:roleId', 'system/role/authUser', '', 1, 1, 'C', '1', '0', 'system:role:edit', '#', 103, 1, sysdate, null, null, '/system/role');
|
||||
insert into sys_menu values('131', '分配角色', '1', '1', 'user-auth/role/:userId', 'system/user/authRole', '', 1, 1, 'C', '1', '0', 'system:user:edit', '#', 103, 1, sysdate, null, null, '/system/user');
|
||||
insert into sys_menu values('132', '字典数据', '1', '6', 'dict-data/index/:dictId', 'system/dict/data', '', 1, 1, 'C', '1', '0', 'system:dict:list', '#', 103, 1, sysdate, null, null, '/system/dict');
|
||||
insert into sys_menu values('133', '文件配置管理', '1', '10', 'oss-config/index', 'system/oss/config', '', 1, 1, 'C', '1', '0', 'system:ossConfig:list', '#', 103, 1, sysdate, null, null, '/system/oss');
|
||||
|
||||
-- springboot-admin监控
|
||||
insert into sys_menu values('117', 'Admin监控', '2', '5', 'Admin', 'monitor/admin/index', '', 1, 0, 'C', '0', '0', 'monitor:admin:list', 'dashboard', 103, 1, sysdate, null, null, 'Admin监控菜单');
|
||||
|
@ -463,7 +463,7 @@ INSERT INTO sys_menu VALUES ('11622', '流程分类', '11616', '1', 'category',
|
||||
INSERT INTO sys_menu VALUES ('11629', '我发起的', '11618', '1', 'myDocument', 'workflow/task/myDocument', '', '1', '1', 'C', '0', '0', '', 'guide', 103, 1, SYSDATE, NULL, NULL, '');
|
||||
INSERT INTO sys_menu VALUES ('11630', '流程监控', '11616', '4', 'monitor', '', '', '1', '0', 'M', '0', '0', '', 'monitor', 103, 1, SYSDATE, NULL, NULL, '');
|
||||
INSERT INTO sys_menu VALUES ('11631', '待办任务', '11630', '2', 'allTaskWaiting', 'workflow/task/allTaskWaiting', '', '1', '1', 'C', '0', '0', '', 'waiting', 103, 1, SYSDATE, NULL, NULL, '');
|
||||
INSERT INTO sys_menu VALUES ('11700', '流程设计', '11616', '5', 'design/index', 'workflow/processDefinition/design', '', '1', '1', 'C', '1', '0', 'workflow:leave:edit', '#', 103, 1, SYSDATE, NULL, NULL, '');
|
||||
INSERT INTO sys_menu VALUES ('11700', '流程设计', '11616', '5', 'design/index', 'workflow/processDefinition/design', '', '1', '1', 'C', '1', '0', 'workflow:leave:edit', '#', 103, 1, SYSDATE, NULL, NULL, '/workflow/processDefinition');
|
||||
INSERT INTO sys_menu VALUES ('11701', '请假申请', '11616', '6', 'leaveEdit/index', 'workflow/leave/leaveEdit', '', '1', '1', 'C', '1', '0', 'workflow:leave:edit', '#', 103, 1, SYSDATE, NULL, NULL, '');
|
||||
|
||||
INSERT INTO sys_menu VALUES ('11623', '流程分类查询', '11622', '1', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:query', '#', 103, 1, SYSDATE, NULL, NULL, '');
|
||||
|
@ -448,11 +448,11 @@ insert into sys_menu values('115', '代码生成', '3', '2', 'gen',
|
||||
insert into sys_menu values('121', '租户管理', '6', '1', 'tenant', 'system/tenant/index', '', '1', '0', 'C', '0', '0', 'system:tenant:list', 'list', 103, 1, now(), null, null, '租户管理菜单');
|
||||
insert into sys_menu values('122', '租户套餐管理', '6', '2', 'tenantPackage', 'system/tenantPackage/index', '', '1', '0', 'C', '0', '0', 'system:tenantPackage:list', 'form', 103, 1, now(), null, null, '租户套餐管理菜单');
|
||||
insert into sys_menu values('123', '客户端管理', '1', '11', 'client', 'system/client/index', '', '1', '0', 'C', '0', '0', 'system:client:list', 'international', 103, 1, now(), null, null, '客户端管理菜单');
|
||||
insert into sys_menu values('116', '修改生成配置', '3', '2', 'gen-edit/index/:tableId', 'tool/gen/editTable', '', '1', '1', 'C', '1', '0', 'tool:gen:edit', '#', 103, 1, now(), null, null, '');
|
||||
insert into sys_menu values('130', '分配用户', '1', '2', 'role-auth/user/:roleId', 'system/role/authUser', '', '1', '1', 'C', '1', '0', 'system:role:edit', '#', 103, 1, now(), null, null, '');
|
||||
insert into sys_menu values('131', '分配角色', '1', '1', 'user-auth/role/:userId', 'system/user/authRole', '', '1', '1', 'C', '1', '0', 'system:user:edit', '#', 103, 1, now(), null, null, '');
|
||||
insert into sys_menu values('132', '字典数据', '1', '6', 'dict-data/index/:dictId', 'system/dict/data', '', '1', '1', 'C', '1', '0', 'system:dict:list', '#', 103, 1, now(), null, null, '');
|
||||
insert into sys_menu values('133', '文件配置管理', '1', '10', 'oss-config/index', 'system/oss/config', '', '1', '1', 'C', '1', '0', 'system:ossConfig:list', '#', 103, 1, now(), null, null, '');
|
||||
insert into sys_menu values('116', '修改生成配置', '3', '2', 'gen-edit/index/:tableId', 'tool/gen/editTable', '', '1', '1', 'C', '1', '0', 'tool:gen:edit', '#', 103, 1, now(), null, null, '/tool/gen');
|
||||
insert into sys_menu values('130', '分配用户', '1', '2', 'role-auth/user/:roleId', 'system/role/authUser', '', '1', '1', 'C', '1', '0', 'system:role:edit', '#', 103, 1, now(), null, null, '/system/role');
|
||||
insert into sys_menu values('131', '分配角色', '1', '1', 'user-auth/role/:userId', 'system/user/authRole', '', '1', '1', 'C', '1', '0', 'system:user:edit', '#', 103, 1, now(), null, null, '/system/user');
|
||||
insert into sys_menu values('132', '字典数据', '1', '6', 'dict-data/index/:dictId', 'system/dict/data', '', '1', '1', 'C', '1', '0', 'system:dict:list', '#', 103, 1, now(), null, null, '/system/dict');
|
||||
insert into sys_menu values('133', '文件配置管理', '1', '10', 'oss-config/index', 'system/oss/config', '', '1', '1', 'C', '1', '0', 'system:ossConfig:list', '#', 103, 1, now(), null, null, '/system/oss');
|
||||
|
||||
-- springboot-admin监控
|
||||
insert into sys_menu values('117', 'Admin监控', '2', '5', 'Admin', 'monitor/admin/index', '', '1', '0', 'C', '0', '0', 'monitor:admin:list', 'dashboard', 103, 1, now(), null, null, 'Admin监控菜单');
|
||||
|
@ -441,7 +441,7 @@ INSERT INTO sys_menu VALUES ('11622', '流程分类', '11616', '1', 'category',
|
||||
INSERT INTO sys_menu VALUES ('11629', '我发起的', '11618', '1', 'myDocument', 'workflow/task/myDocument', '', '1', '1', 'C', '0', '0', '', 'guide', 103, 1, now(), NULL, NULL, '');
|
||||
INSERT INTO sys_menu VALUES ('11630', '流程监控', '11616', '4', 'monitor', '', '', '1', '0', 'M', '0', '0', '', 'monitor', 103, 1, now(), NULL, NULL, '');
|
||||
INSERT INTO sys_menu VALUES ('11631', '待办任务', '11630', '2', 'allTaskWaiting', 'workflow/task/allTaskWaiting', '', '1', '1', 'C', '0', '0', '', 'waiting', 103, 1, now(), NULL, NULL, '');
|
||||
INSERT INTO sys_menu VALUES ('11700', '流程设计', '11616', '5', 'design/index', 'workflow/processDefinition/design', '', '1', '1', 'C', '1', '0', 'workflow:leave:edit', '#', 103, 1, now(), NULL, NULL, '');
|
||||
INSERT INTO sys_menu VALUES ('11700', '流程设计', '11616', '5', 'design/index', 'workflow/processDefinition/design', '', '1', '1', 'C', '1', '0', 'workflow:leave:edit', '#', 103, 1, now(), NULL, NULL, '/workflow/processDefinition');
|
||||
INSERT INTO sys_menu VALUES ('11701', '请假申请', '11616', '6', 'leaveEdit/index', 'workflow/leave/leaveEdit', '', '1', '1', 'C', '1', '0', 'workflow:leave:edit', '#', 103, 1, now(), NULL, NULL, '');
|
||||
|
||||
INSERT INTO sys_menu VALUES ('11623', '流程分类查询', '11622', '1', '#', '', '', '1', '0', 'F', '0', '0', 'workflow:category:query', '#', 103, 1, now(), NULL, NULL, '');
|
||||
|
@ -282,11 +282,11 @@ insert into sys_menu values('115', '代码生成', '3', '2', 'gen',
|
||||
insert into sys_menu values('121', '租户管理', '6', '1', 'tenant', 'system/tenant/index', '', 1, 0, 'C', '0', '0', 'system:tenant:list', 'list', 103, 1, sysdate(), null, null, '租户管理菜单');
|
||||
insert into sys_menu values('122', '租户套餐管理', '6', '2', 'tenantPackage', 'system/tenantPackage/index', '', 1, 0, 'C', '0', '0', 'system:tenantPackage:list', 'form', 103, 1, sysdate(), null, null, '租户套餐管理菜单');
|
||||
insert into sys_menu values('123', '客户端管理', '1', '11', 'client', 'system/client/index', '', 1, 0, 'C', '0', '0', 'system:client:list', 'international', 103, 1, sysdate(), null, null, '客户端管理菜单');
|
||||
insert into sys_menu values('116', '修改生成配置', '3', '2', 'gen-edit/index/:tableId', 'tool/gen/editTable', '', 1, 1, 'C', '1', '0', 'tool:gen:edit', '#', 103, 1, sysdate(), null, null, '');
|
||||
insert into sys_menu values('130', '分配用户', '1', '2', 'role-auth/user/:roleId', 'system/role/authUser', '', 1, 1, 'C', '1', '0', 'system:role:edit', '#', 103, 1, sysdate(), null, null, '');
|
||||
insert into sys_menu values('131', '分配角色', '1', '1', 'user-auth/role/:userId', 'system/user/authRole', '', 1, 1, 'C', '1', '0', 'system:user:edit', '#', 103, 1, sysdate(), null, null, '');
|
||||
insert into sys_menu values('132', '字典数据', '1', '6', 'dict-data/index/:dictId', 'system/dict/data', '', 1, 1, 'C', '1', '0', 'system:dict:list', '#', 103, 1, sysdate(), null, null, '');
|
||||
insert into sys_menu values('133', '文件配置管理', '1', '10', 'oss-config/index', 'system/oss/config', '', 1, 1, 'C', '1', '0', 'system:ossConfig:list', '#', 103, 1, sysdate(), null, null, '');
|
||||
insert into sys_menu values('116', '修改生成配置', '3', '2', 'gen-edit/index/:tableId', 'tool/gen/editTable', '', 1, 1, 'C', '1', '0', 'tool:gen:edit', '#', 103, 1, sysdate(), null, null, '/tool/gen');
|
||||
insert into sys_menu values('130', '分配用户', '1', '2', 'role-auth/user/:roleId', 'system/role/authUser', '', 1, 1, 'C', '1', '0', 'system:role:edit', '#', 103, 1, sysdate(), null, null, '/system/role');
|
||||
insert into sys_menu values('131', '分配角色', '1', '1', 'user-auth/role/:userId', 'system/user/authRole', '', 1, 1, 'C', '1', '0', 'system:user:edit', '#', 103, 1, sysdate(), null, null, '/system/user');
|
||||
insert into sys_menu values('132', '字典数据', '1', '6', 'dict-data/index/:dictId', 'system/dict/data', '', 1, 1, 'C', '1', '0', 'system:dict:list', '#', 103, 1, sysdate(), null, null, '/system/dict');
|
||||
insert into sys_menu values('133', '文件配置管理', '1', '10', 'oss-config/index', 'system/oss/config', '', 1, 1, 'C', '1', '0', 'system:ossConfig:list', '#', 103, 1, sysdate(), null, null, '/system/oss');
|
||||
|
||||
-- springboot-admin监控
|
||||
insert into sys_menu values('117', 'Admin监控', '2', '5', 'Admin', 'monitor/admin/index', '', 1, 0, 'C', '0', '0', 'monitor:admin:list', 'dashboard', 103, 1, sysdate(), null, null, 'Admin监控菜单');
|
||||
|
@ -262,7 +262,7 @@ INSERT INTO sys_menu VALUES ('11801', '流程表达式', '11616', '2', 'spel',
|
||||
insert into sys_menu values ('11629', '我发起的', '11618', '1', 'myDocument', 'workflow/task/myDocument', '', '1', '1', 'C', '0', '0', '', 'guide', 103, 1, sysdate(), NULL, NULL, '');
|
||||
insert into sys_menu values ('11630', '流程监控', '11616', '4', 'monitor', '', '', '1', '0', 'M', '0', '0', '', 'monitor', 103, 1, sysdate(), NULL, NULL, '');
|
||||
insert into sys_menu values ('11631', '待办任务', '11630', '2', 'allTaskWaiting', 'workflow/task/allTaskWaiting', '', '1', '1', 'C', '0', '0', '', 'waiting', 103, 1, sysdate(), NULL, NULL, '');
|
||||
insert into sys_menu values ('11700', '流程设计', '11616', '5', 'design/index', 'workflow/processDefinition/design', '', 1, 1, 'C', '1', '0', 'workflow:leave:edit', '#', 103, 1, sysdate(), null, null, '');
|
||||
insert into sys_menu values ('11700', '流程设计', '11616', '5', 'design/index', 'workflow/processDefinition/design', '', 1, 1, 'C', '1', '0', 'workflow:leave:edit', '#', 103, 1, sysdate(), null, null, '/workflow/processDefinition');
|
||||
insert into sys_menu values ('11701', '请假申请', '11616', '6', 'leaveEdit/index', 'workflow/leave/leaveEdit', '', 1, 1, 'C', '1', '0', 'workflow:leave:edit', '#', 103, 1, sysdate(), null, null, '');
|
||||
-- 流程分类管理相关按钮
|
||||
insert into sys_menu values ('11623', '流程分类查询', '11622', '1', '#', '', '', 1, 0, 'F', '0', '0', 'workflow:category:query', '#', 103, 1,sysdate(), null, null, '');
|
||||
|
@ -1690,15 +1690,15 @@ INSERT sys_menu VALUES (122, N'租户套餐管理', 6, 2, N'tenantPackage', N'sy
|
||||
GO
|
||||
INSERT sys_menu VALUES (123, N'客户端管理', 1, 11, N'client', N'system/client/index', N'', 1, 0, N'C', N'0', N'0', N'system:client:list', N'international', 103, 1, getdate(), NULL, NULL, N'客户端管理菜单')
|
||||
GO
|
||||
INSERT sys_menu VALUES (116, N'修改生成配置', 3, 2, N'gen-edit/index/:tableId', N'tool/gen/editTable', N'', 1, 1, N'C', N'1', N'0', N'tool:gen:edit', N'#', 103, 1, getdate(), null, null, N'');
|
||||
INSERT sys_menu VALUES (116, N'修改生成配置', 3, 2, N'gen-edit/index/:tableId', N'tool/gen/editTable', N'', 1, 1, N'C', N'1', N'0', N'tool:gen:edit', N'#', 103, 1, getdate(), null, null, N'/tool/gen');
|
||||
GO
|
||||
INSERT sys_menu VALUES (130, N'分配用户', 1, 2, N'role-auth/user/:roleId', N'system/role/authUser', N'', 1, 1, N'C', N'1', N'0', N'system:role:edit', N'#', 103, 1, getdate(), null, null, N'');
|
||||
INSERT sys_menu VALUES (130, N'分配用户', 1, 2, N'role-auth/user/:roleId', N'system/role/authUser', N'', 1, 1, N'C', N'1', N'0', N'system:role:edit', N'#', 103, 1, getdate(), null, null, N'/system/role');
|
||||
GO
|
||||
INSERT sys_menu VALUES (131, N'分配角色', 1, 1, N'user-auth/role/:userId', N'system/user/authRole', N'', 1, 1, N'C', N'1', N'0', N'system:user:edit', N'#', 103, 1, getdate(), null, null, N'');
|
||||
INSERT sys_menu VALUES (131, N'分配角色', 1, 1, N'user-auth/role/:userId', N'system/user/authRole', N'', 1, 1, N'C', N'1', N'0', N'system:user:edit', N'#', 103, 1, getdate(), null, null, N'/system/user');
|
||||
GO
|
||||
INSERT sys_menu VALUES (132, N'字典数据', 1, 6, N'dict-data/index/:dictId', N'system/dict/data', N'', 1, 1, N'C', N'1', N'0', N'system:dict:list', N'#', 103, 1, getdate(), null, null, N'');
|
||||
INSERT sys_menu VALUES (132, N'字典数据', 1, 6, N'dict-data/index/:dictId', N'system/dict/data', N'', 1, 1, N'C', N'1', N'0', N'system:dict:list', N'#', 103, 1, getdate(), null, null, N'/system/dict');
|
||||
GO
|
||||
INSERT sys_menu VALUES (133, N'文件配置管理', 1, 10, N'oss-config/index', N'system/oss/config', N'', 1, 1, N'C', N'1', N'0', N'system:ossConfig:list', N'#', 103, 1, getdate(), null, null, N'');
|
||||
INSERT sys_menu VALUES (133, N'文件配置管理', 1, 10, N'oss-config/index', N'system/oss/config', N'', 1, 1, N'C', N'1', N'0', N'system:ossConfig:list', N'#', 103, 1, getdate(), null, null, N'/system/oss');
|
||||
GO
|
||||
|
||||
INSERT sys_menu VALUES (117, N'Admin监控', 2, 5, N'Admin', N'monitor/admin/index', N'', 1, 0, N'C', N'0', N'0', N'monitor:admin:list', N'dashboard', 103, 1, getdate(), NULL, NULL, N'Admin监控菜单');
|
||||
|
@ -1519,7 +1519,7 @@ INSERT sys_menu VALUES (11630, N'流程监控', 11616, 4, N'monitor', NULL, N'',
|
||||
GO
|
||||
INSERT sys_menu VALUES (11631, N'待办任务', 11630, 2, N'allTaskWaiting', N'workflow/task/allTaskWaiting', N'', 1, 1, N'C', N'0', N'0', N'', N'waiting', 103, 1, GETDATE(), NULL, NULL, N'');
|
||||
GO
|
||||
INSERT sys_menu VALUES (11700, N'流程设计', 11616, 5, N'design/index', N'workflow/processDefinition/design', N'', 1, 1, N'C', N'1', N'0', N'workflow:leave:edit', N'#', 103, 1, GETDATE(), NULL, NULL, N'');
|
||||
INSERT sys_menu VALUES (11700, N'流程设计', 11616, 5, N'design/index', N'workflow/processDefinition/design', N'', 1, 1, N'C', N'1', N'0', N'workflow:leave:edit', N'#', 103, 1, GETDATE(), NULL, NULL, N'/workflow/processDefinition');
|
||||
GO
|
||||
INSERT sys_menu VALUES (11701, N'请假申请', 11616, 6, N'leaveEdit/index', N'workflow/leave/leaveEdit', N'', 1, 1, N'C', N'1', N'0', N'workflow:leave:edit', N'#', 103, 1, GETDATE(), NULL, NULL, N'');
|
||||
GO
|
||||
|
@ -88,3 +88,10 @@ COMMENT ON COLUMN flow_instance_biz_ext.business_id IS '业务Id';
|
||||
|
||||
ALTER TABLE test_leave ADD COLUMN apply_code VARCHAR2(50) NOT NULL;
|
||||
COMMENT ON COLUMN test_leave.apply_code IS '申请编号';
|
||||
|
||||
update sys_menu set remark = '/tool/gen' where menu_id = 116;
|
||||
update sys_menu set remark = '/system/role' where menu_id = 130;
|
||||
update sys_menu set remark = '/system/user' where menu_id = 131;
|
||||
update sys_menu set remark = '/system/dict' where menu_id = 132;
|
||||
update sys_menu set remark = '/system/oss' where menu_id = 133;
|
||||
update sys_menu set remark = '/workflow/processDefinition' where menu_id = 11700;
|
||||
|
@ -90,3 +90,10 @@ COMMENT ON COLUMN flow_instance_biz_ext.business_id IS '业务Id';
|
||||
|
||||
ALTER TABLE test_leave ADD COLUMN apply_code VARCHAR(50) NOT NULL;
|
||||
COMMENT ON COLUMN test_leave.apply_code IS '申请编号';
|
||||
|
||||
update sys_menu set remark = '/tool/gen' where menu_id = 116;
|
||||
update sys_menu set remark = '/system/role' where menu_id = 130;
|
||||
update sys_menu set remark = '/system/user' where menu_id = 131;
|
||||
update sys_menu set remark = '/system/dict' where menu_id = 132;
|
||||
update sys_menu set remark = '/system/oss' where menu_id = 133;
|
||||
update sys_menu set remark = '/workflow/processDefinition' where menu_id = 11700;
|
||||
|
@ -279,3 +279,16 @@ EXEC sp_addextendedproperty
|
||||
'TABLE', N'test_leave',
|
||||
'COLUMN', N'apply_code'
|
||||
GO
|
||||
|
||||
update sys_menu set remark = N'/tool/gen' where menu_id = 116;
|
||||
GO
|
||||
update sys_menu set remark = N'/system/role' where menu_id = 130;
|
||||
GO
|
||||
update sys_menu set remark = N'/system/user' where menu_id = 131;
|
||||
GO
|
||||
update sys_menu set remark = N'/system/dict' where menu_id = 132;
|
||||
GO
|
||||
update sys_menu set remark = N'/system/oss' where menu_id = 133;
|
||||
GO
|
||||
update sys_menu set remark = N'/workflow/processDefinition' where menu_id = 11700;
|
||||
GO
|
||||
|
@ -58,3 +58,10 @@ create table flow_instance_biz_ext (
|
||||
|
||||
ALTER TABLE `test_leave`
|
||||
ADD COLUMN `apply_code` varchar(50) NOT NULL COMMENT '申请编号' AFTER `tenant_id`;
|
||||
|
||||
update sys_menu set remark = '/tool/gen' where menu_id = 116;
|
||||
update sys_menu set remark = '/system/role' where menu_id = 130;
|
||||
update sys_menu set remark = '/system/user' where menu_id = 131;
|
||||
update sys_menu set remark = '/system/dict' where menu_id = 132;
|
||||
update sys_menu set remark = '/system/oss' where menu_id = 133;
|
||||
update sys_menu set remark = '/workflow/processDefinition' where menu_id = 11700;
|
||||
|
Reference in New Issue
Block a user