mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 02:08:15 +08:00
fix 按要求去掉filterSet、findFirstIfPresent
恢复OpenApiHandler、EncryptorManager
This commit is contained in:
parent
79940cb5e8
commit
db36b34114
@ -21,7 +21,7 @@ import java.util.stream.Collectors;
|
|||||||
public class StreamUtils {
|
public class StreamUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将collection-list过滤
|
* 将collection过滤
|
||||||
*
|
*
|
||||||
* @param collection 需要转化的集合
|
* @param collection 需要转化的集合
|
||||||
* @param function 过滤方法
|
* @param function 过滤方法
|
||||||
@ -35,20 +35,6 @@ public class StreamUtils {
|
|||||||
return collection.stream().filter(function).collect(Collectors.toList());
|
return collection.stream().filter(function).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 将collection-set过滤
|
|
||||||
*
|
|
||||||
* @param collection 需要转化的集合
|
|
||||||
* @param function 过滤方法
|
|
||||||
* @return 过滤后的Set
|
|
||||||
*/
|
|
||||||
public static <E> Set<E> filterSet(Collection<E> collection, Predicate<E> function) {
|
|
||||||
if (CollUtil.isEmpty(collection)) {
|
|
||||||
return CollUtil.newHashSet() ;
|
|
||||||
}
|
|
||||||
return collection.stream().filter(function).collect(Collectors.toSet());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 找到流中满足条件的第一个元素
|
* 找到流中满足条件的第一个元素
|
||||||
*
|
*
|
||||||
@ -63,19 +49,6 @@ public class StreamUtils {
|
|||||||
return collection.stream().filter(function).findFirst().orElse(null);
|
return collection.stream().filter(function).findFirst().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 找到流中第一个满足条件的元素之后执行操作
|
|
||||||
* @param collection 需要查询的集合
|
|
||||||
* @param function 过滤方法
|
|
||||||
* @param action 执行的动作
|
|
||||||
*/
|
|
||||||
public static <E> void findFirstIfPresent(Collection<E> collection, Predicate<E> function, Consumer<E> action) {
|
|
||||||
if (CollUtil.isEmpty(collection)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
collection.stream().filter(function).findFirst().ifPresent(action);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 找到流中任意一个满足条件的元素
|
* 找到流中任意一个满足条件的元素
|
||||||
*
|
*
|
||||||
|
|||||||
@ -154,7 +154,9 @@ public class OpenApiHandler extends OpenAPIService {
|
|||||||
buildTagsFromClass(handlerMethod.getBeanType(), tags, tagsStr, locale);
|
buildTagsFromClass(handlerMethod.getBeanType(), tags, tagsStr, locale);
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(tagsStr))
|
if (!CollectionUtils.isEmpty(tagsStr))
|
||||||
tagsStr = StreamUtils.toSet(tagsStr, str -> propertyResolverUtils.resolve(str, locale));
|
tagsStr = tagsStr.stream()
|
||||||
|
.map(str -> propertyResolverUtils.resolve(str, locale))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
if (springdocTags.containsKey(handlerMethod)) {
|
if (springdocTags.containsKey(handlerMethod)) {
|
||||||
io.swagger.v3.oas.models.tags.Tag tag = springdocTags.get(handlerMethod);
|
io.swagger.v3.oas.models.tags.Tag tag = springdocTags.get(handlerMethod);
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import cn.hutool.core.util.ReflectUtil;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.ibatis.io.Resources;
|
import org.apache.ibatis.io.Resources;
|
||||||
import org.dromara.common.core.utils.StreamUtils;
|
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.encrypt.annotation.EncryptField;
|
import org.dromara.common.encrypt.annotation.EncryptField;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
@ -20,6 +19,7 @@ import org.springframework.util.ClassUtils;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加密管理类
|
* 加密管理类
|
||||||
@ -146,8 +146,9 @@ public class EncryptorManager {
|
|||||||
fieldSet.addAll(Arrays.asList(fields));
|
fieldSet.addAll(Arrays.asList(fields));
|
||||||
clazz = clazz.getSuperclass();
|
clazz = clazz.getSuperclass();
|
||||||
}
|
}
|
||||||
fieldSet = StreamUtils.filterSet(fieldSet, field ->
|
fieldSet = fieldSet.stream().filter(field ->
|
||||||
field.isAnnotationPresent(EncryptField.class) && field.getType() == String.class);
|
field.isAnnotationPresent(EncryptField.class) && field.getType() == String.class)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
for (Field field : fieldSet) {
|
for (Field field : fieldSet) {
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -648,9 +648,7 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
|
|||||||
List<WfNodeConfigVo> wfNodeConfigVoList = wfNodeConfigService.selectByDefIds(processDefinitionIds);
|
List<WfNodeConfigVo> wfNodeConfigVoList = wfNodeConfigService.selectByDefIds(processDefinitionIds);
|
||||||
for (ProcessInstanceVo processInstanceVo : list) {
|
for (ProcessInstanceVo processInstanceVo : list) {
|
||||||
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
StreamUtils.findFirstIfPresent(wfNodeConfigVoList,
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(processInstanceVo.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(processInstanceVo::setWfNodeConfigVo);
|
||||||
e -> e.getDefinitionId().equals(processInstanceVo.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask()),
|
|
||||||
processInstanceVo::setWfNodeConfigVo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -281,13 +281,8 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
task.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId(), userService));
|
task.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId(), userService));
|
||||||
task.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null);
|
task.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null);
|
||||||
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
StreamUtils.findFirstIfPresent(wfNodeConfigVoList,
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask()),
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
task::setWfNodeConfigVo);
|
|
||||||
|
|
||||||
StreamUtils.findFirstIfPresent(wfNodeConfigVoList,
|
|
||||||
e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask()),
|
|
||||||
task::setWfNodeConfigVo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,9 +333,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
for (Task task : taskList) {
|
for (Task task : taskList) {
|
||||||
TaskVo taskVo = BeanUtil.toBean(task, TaskVo.class);
|
TaskVo taskVo = BeanUtil.toBean(task, TaskVo.class);
|
||||||
if (CollUtil.isNotEmpty(processInstanceList)) {
|
if (CollUtil.isNotEmpty(processInstanceList)) {
|
||||||
StreamUtils.findFirstIfPresent(processInstanceList,
|
processInstanceList.stream().filter(e -> e.getId().equals(task.getProcessInstanceId())).findFirst().ifPresent(e -> {
|
||||||
e -> e.getId().equals(task.getProcessInstanceId()),
|
|
||||||
e -> {
|
|
||||||
taskVo.setBusinessStatus(e.getBusinessStatus());
|
taskVo.setBusinessStatus(e.getBusinessStatus());
|
||||||
taskVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(taskVo.getBusinessStatus()));
|
taskVo.setBusinessStatusName(BusinessStatusEnum.findByStatus(taskVo.getBusinessStatus()));
|
||||||
taskVo.setProcessDefinitionKey(e.getProcessDefinitionKey());
|
taskVo.setProcessDefinitionKey(e.getProcessDefinitionKey());
|
||||||
@ -353,13 +346,8 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
taskVo.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId(), userService));
|
taskVo.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId(), userService));
|
||||||
taskVo.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null);
|
taskVo.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null);
|
||||||
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
StreamUtils.findFirstIfPresent(wfNodeConfigVoList,
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(taskVo::setWfNodeConfigVo);
|
||||||
e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask()),
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(taskVo::setWfNodeConfigVo);
|
||||||
taskVo::setWfNodeConfigVo);
|
|
||||||
|
|
||||||
StreamUtils.findFirstIfPresent(wfNodeConfigVoList,
|
|
||||||
e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask()),
|
|
||||||
taskVo::setWfNodeConfigVo);
|
|
||||||
}
|
}
|
||||||
list.add(taskVo);
|
list.add(taskVo);
|
||||||
}
|
}
|
||||||
@ -393,13 +381,8 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
for (TaskVo task : taskList) {
|
for (TaskVo task : taskList) {
|
||||||
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
||||||
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
StreamUtils.findFirstIfPresent(wfNodeConfigVoList,
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask()),
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
task::setWfNodeConfigVo);
|
|
||||||
|
|
||||||
StreamUtils.findFirstIfPresent(wfNodeConfigVoList,
|
|
||||||
e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask()),
|
|
||||||
task::setWfNodeConfigVo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -434,13 +417,8 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
for (TaskVo task : taskList) {
|
for (TaskVo task : taskList) {
|
||||||
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
||||||
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
StreamUtils.findFirstIfPresent(wfNodeConfigVoList,
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask()),
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
task::setWfNodeConfigVo);
|
|
||||||
|
|
||||||
StreamUtils.findFirstIfPresent(wfNodeConfigVoList,
|
|
||||||
e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask()),
|
|
||||||
task::setWfNodeConfigVo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -467,13 +445,8 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
for (TaskVo task : taskList) {
|
for (TaskVo task : taskList) {
|
||||||
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
||||||
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
StreamUtils.findFirstIfPresent(wfNodeConfigVoList,
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask()),
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
task::setWfNodeConfigVo);
|
|
||||||
|
|
||||||
StreamUtils.findFirstIfPresent(wfNodeConfigVoList,
|
|
||||||
e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask()),
|
|
||||||
task::setWfNodeConfigVo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -731,9 +704,9 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
List<HistoricTaskInstance> instanceList = QueryUtils.hisTaskInstanceQuery(processInstanceId).finished().orderByHistoricTaskInstanceEndTime().desc().list();
|
List<HistoricTaskInstance> instanceList = QueryUtils.hisTaskInstanceQuery(processInstanceId).finished().orderByHistoricTaskInstanceEndTime().desc().list();
|
||||||
List<Task> list = QueryUtils.taskQuery(processInstanceId).list();
|
List<Task> list = QueryUtils.taskQuery(processInstanceId).list();
|
||||||
for (Task t : list) {
|
for (Task t : list) {
|
||||||
StreamUtils.findFirstIfPresent(instanceList,
|
instanceList.stream().filter(e -> e.getTaskDefinitionKey().equals(t.getTaskDefinitionKey())).findFirst().ifPresent(e -> {
|
||||||
e -> e.getTaskDefinitionKey().equals(t.getTaskDefinitionKey()),
|
taskService.setAssignee(t.getId(), e.getAssignee());
|
||||||
e -> taskService.setAssignee(t.getId(), e.getAssignee()));
|
});
|
||||||
}
|
}
|
||||||
//发送消息
|
//发送消息
|
||||||
String message = "您的【" + processInstance.getName() + "】单据已经被驳回,请您注意查收。";
|
String message = "您的【" + processInstance.getName() + "】单据已经被驳回,请您注意查收。";
|
||||||
@ -861,9 +834,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
taskVo.setName(task.getName());
|
taskVo.setName(task.getName());
|
||||||
taskVo.setAssignee(userId);
|
taskVo.setAssignee(userId);
|
||||||
if (CollUtil.isNotEmpty(userList)) {
|
if (CollUtil.isNotEmpty(userList)) {
|
||||||
StreamUtils.findFirstIfPresent(userList,
|
userList.stream().filter(u -> u.getUserId().toString().equals(userId.toString())).findFirst().ifPresent(u -> taskVo.setAssigneeName(u.getNickName()));
|
||||||
u -> u.getUserId().toString().equals(userId.toString()),
|
|
||||||
u -> taskVo.setAssigneeName(u.getNickName()));
|
|
||||||
}
|
}
|
||||||
taskListVo.add(taskVo);
|
taskListVo.add(taskVo);
|
||||||
}
|
}
|
||||||
@ -881,9 +852,7 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
taskVo.setName(t.getName());
|
taskVo.setName(t.getName());
|
||||||
taskVo.setAssignee(Long.valueOf(t.getAssignee()));
|
taskVo.setAssignee(Long.valueOf(t.getAssignee()));
|
||||||
if (CollUtil.isNotEmpty(userList)) {
|
if (CollUtil.isNotEmpty(userList)) {
|
||||||
StreamUtils.findFirstIfPresent(userList,
|
userList.stream().filter(u -> u.getUserId().toString().equals(t.getAssignee())).findFirst().ifPresent(e -> taskVo.setAssigneeName(e.getNickName()));
|
||||||
u -> u.getUserId().toString().equals(t.getAssignee()),
|
|
||||||
e -> taskVo.setAssigneeName(e.getNickName()));
|
|
||||||
}
|
}
|
||||||
taskListVo.add(taskVo);
|
taskListVo.add(taskVo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,9 +67,7 @@ public class WfNodeConfigServiceImpl implements IWfNodeConfigService {
|
|||||||
List<Long> formIds = StreamUtils.toList(wfNodeConfigVos, WfNodeConfigVo::getFormId);
|
List<Long> formIds = StreamUtils.toList(wfNodeConfigVos, WfNodeConfigVo::getFormId);
|
||||||
List<WfFormManageVo> wfFormManageVos = wfFormManageService.queryByIds(formIds);
|
List<WfFormManageVo> wfFormManageVos = wfFormManageService.queryByIds(formIds);
|
||||||
for (WfNodeConfigVo wfNodeConfigVo : wfNodeConfigVos) {
|
for (WfNodeConfigVo wfNodeConfigVo : wfNodeConfigVos) {
|
||||||
StreamUtils.findFirstIfPresent(wfFormManageVos,
|
wfFormManageVos.stream().filter(e -> ObjectUtil.equals(e.getId(), wfNodeConfigVo.getFormId())).findFirst().ifPresent(wfNodeConfigVo::setWfFormManageVo);
|
||||||
e -> ObjectUtil.equals(e.getId(), wfNodeConfigVo.getFormId()),
|
|
||||||
wfNodeConfigVo::setWfFormManageVo);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return wfNodeConfigVos;
|
return wfNodeConfigVos;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user