mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-03-27 07:43:24 +08:00
Merge remote-tracking branch 'origin/dev' into futuer/boot4
This commit is contained in:
@@ -224,13 +224,8 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|||||||
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String userId = LoginHelper.getUserIdStr();
|
// 发送事件
|
||||||
for (FlowInstance instance : flowInstances) {
|
processDeleteHandler(flowInstances);
|
||||||
if (LoginHelper.isSuperAdmin() || instance.getCreateBy().equals(userId)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
throw new ServiceException("权限不足,无法删除流程实例信息!");
|
|
||||||
}
|
|
||||||
return insService.remove(StreamUtils.toList(flowInstances, FlowInstance::getId));
|
return insService.remove(StreamUtils.toList(flowInstances, FlowInstance::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,34 +239,13 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean deleteByInstanceIds(List<Long> instanceIds) {
|
public boolean deleteByInstanceIds(List<Long> instanceIds) {
|
||||||
// 获取实例信息
|
// 获取实例信息
|
||||||
List<Instance> instances = insService.getByIds(instanceIds);
|
List<FlowInstance> flowInstances = flowInstanceMapper.selectByIds(instanceIds);
|
||||||
if (CollUtil.isEmpty(instances)) {
|
if (CollUtil.isEmpty(flowInstances)) {
|
||||||
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String userId = LoginHelper.getUserIdStr();
|
// 发送事件
|
||||||
for (Instance instance : instances) {
|
processDeleteHandler(flowInstances);
|
||||||
if (LoginHelper.isSuperAdmin() || instance.getCreateBy().equals(userId)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
throw new ServiceException("权限不足,无法删除流程实例信息!");
|
|
||||||
}
|
|
||||||
// 获取定义信息
|
|
||||||
Map<Long, Definition> definitionMap = StreamUtils.toMap(
|
|
||||||
defService.getByIds(StreamUtils.toList(instances, Instance::getDefinitionId)),
|
|
||||||
Definition::getId,
|
|
||||||
Function.identity()
|
|
||||||
);
|
|
||||||
|
|
||||||
// 逐一触发删除事件
|
|
||||||
instances.forEach(instance -> {
|
|
||||||
Definition definition = definitionMap.get(instance.getDefinitionId());
|
|
||||||
if (ObjectUtil.isNull(definition)) {
|
|
||||||
log.warn("实例 ID: {} 对应的流程定义信息未找到,跳过删除事件触发。", instance.getId());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
flowProcessEventHandler.processDeleteHandler(definition.getFlowCode(), instance.getBusinessId());
|
|
||||||
});
|
|
||||||
// 删除实例
|
// 删除实例
|
||||||
return insService.remove(instanceIds);
|
return insService.remove(instanceIds);
|
||||||
}
|
}
|
||||||
@@ -286,33 +260,13 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean deleteHisByInstanceIds(List<Long> instanceIds) {
|
public boolean deleteHisByInstanceIds(List<Long> instanceIds) {
|
||||||
// 获取实例信息
|
// 获取实例信息
|
||||||
List<Instance> instances = insService.getByIds(instanceIds);
|
List<FlowInstance> flowInstances = flowInstanceMapper.selectByIds(instanceIds);
|
||||||
if (CollUtil.isEmpty(instances)) {
|
if (CollUtil.isEmpty(flowInstances)) {
|
||||||
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String userId = LoginHelper.getUserIdStr();
|
// 发送事件
|
||||||
for (Instance instance : instances) {
|
processDeleteHandler(flowInstances);
|
||||||
if (LoginHelper.isSuperAdmin() || instance.getCreateBy().equals(userId)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
throw new ServiceException("权限不足,无法删除流程实例信息!");
|
|
||||||
}
|
|
||||||
// 获取定义信息
|
|
||||||
Map<Long, Definition> definitionMap = StreamUtils.toMap(
|
|
||||||
defService.getByIds(StreamUtils.toList(instances, Instance::getDefinitionId)),
|
|
||||||
Definition::getId,
|
|
||||||
Function.identity()
|
|
||||||
);
|
|
||||||
// 逐一触发删除事件
|
|
||||||
instances.forEach(instance -> {
|
|
||||||
Definition definition = definitionMap.get(instance.getDefinitionId());
|
|
||||||
if (ObjectUtil.isNull(definition)) {
|
|
||||||
log.warn("实例 ID: {} 对应的流程定义信息未找到,跳过删除事件触发。", instance.getId());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
flowProcessEventHandler.processDeleteHandler(definition.getFlowCode(), instance.getBusinessId());
|
|
||||||
});
|
|
||||||
List<FlowTask> flowTaskList = flwTaskService.selectByInstIds(instanceIds);
|
List<FlowTask> flowTaskList = flwTaskService.selectByInstIds(instanceIds);
|
||||||
if (CollUtil.isNotEmpty(flowTaskList)) {
|
if (CollUtil.isNotEmpty(flowTaskList)) {
|
||||||
FlowEngine.userService().deleteByTaskIds(StreamUtils.toList(flowTaskList, FlowTask::getId));
|
FlowEngine.userService().deleteByTaskIds(StreamUtils.toList(flowTaskList, FlowTask::getId));
|
||||||
@@ -323,6 +277,35 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void processDeleteHandler(List<FlowInstance> flowInstances) {
|
||||||
|
|
||||||
|
String userId = LoginHelper.getUserIdStr();
|
||||||
|
for (FlowInstance flowInstance : flowInstances) {
|
||||||
|
//如果创建人与当前登陆人一致或者当前登陆人为管理员才能删除
|
||||||
|
if (LoginHelper.isSuperAdmin() || flowInstance.getCreateBy().equals(userId)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
throw new ServiceException("权限不足,无法删除流程实例信息!");
|
||||||
|
}
|
||||||
|
// 获取定义信息
|
||||||
|
Map<Long, Definition> definitionMap = StreamUtils.toMap(
|
||||||
|
defService.getByIds(StreamUtils.toList(flowInstances, Instance::getDefinitionId)),
|
||||||
|
Definition::getId,
|
||||||
|
Function.identity()
|
||||||
|
);
|
||||||
|
|
||||||
|
// 逐一触发删除事件
|
||||||
|
flowInstances.forEach(instance -> {
|
||||||
|
Definition definition = definitionMap.get(instance.getDefinitionId());
|
||||||
|
if (ObjectUtil.isNull(definition)) {
|
||||||
|
log.warn("实例 ID: {} 对应的流程定义信息未找到,跳过删除事件触发。", instance.getId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
flowProcessEventHandler.processDeleteHandler(definition.getFlowCode(), instance.getBusinessId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 撤销流程
|
* 撤销流程
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user