|
|
|
@ -19,13 +19,13 @@ import org.dromara.common.core.utils.StringUtils;
|
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
|
import org.dromara.warm.flow.core.FlowEngine;
|
|
|
|
|
|
|
|
import org.dromara.warm.flow.core.constant.ExceptionCons;
|
|
|
|
import org.dromara.warm.flow.core.constant.ExceptionCons;
|
|
|
|
import org.dromara.warm.flow.core.dto.FlowParams;
|
|
|
|
import org.dromara.warm.flow.core.dto.FlowParams;
|
|
|
|
import org.dromara.warm.flow.core.entity.Definition;
|
|
|
|
import org.dromara.warm.flow.core.entity.Definition;
|
|
|
|
import org.dromara.warm.flow.core.entity.Instance;
|
|
|
|
import org.dromara.warm.flow.core.entity.Instance;
|
|
|
|
import org.dromara.warm.flow.core.entity.Task;
|
|
|
|
import org.dromara.warm.flow.core.entity.Task;
|
|
|
|
import org.dromara.warm.flow.core.enums.NodeType;
|
|
|
|
import org.dromara.warm.flow.core.enums.NodeType;
|
|
|
|
|
|
|
|
import org.dromara.warm.flow.core.enums.SkipType;
|
|
|
|
import org.dromara.warm.flow.core.service.ChartService;
|
|
|
|
import org.dromara.warm.flow.core.service.ChartService;
|
|
|
|
import org.dromara.warm.flow.core.service.DefService;
|
|
|
|
import org.dromara.warm.flow.core.service.DefService;
|
|
|
|
import org.dromara.warm.flow.core.service.InsService;
|
|
|
|
import org.dromara.warm.flow.core.service.InsService;
|
|
|
|
@ -185,7 +185,7 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public boolean deleteByBusinessIds(List<Long> businessIds) {
|
|
|
|
public boolean deleteByBusinessIds(List<Long> businessIds) {
|
|
|
|
List<FlowInstance> flowInstances = flowInstanceMapper.selectList(new LambdaQueryWrapper<FlowInstance>().in(FlowInstance::getBusinessId, StreamUtils.toList(businessIds,Convert::toStr)));
|
|
|
|
List<FlowInstance> flowInstances = flowInstanceMapper.selectList(new LambdaQueryWrapper<FlowInstance>().in(FlowInstance::getBusinessId, StreamUtils.toList(businessIds, Convert::toStr)));
|
|
|
|
if (CollUtil.isEmpty(flowInstances)) {
|
|
|
|
if (CollUtil.isEmpty(flowInstances)) {
|
|
|
|
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
|
|
|
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
@ -244,19 +244,16 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|
|
|
throw new ServiceException(ExceptionCons.NOT_FOUNT_DEF);
|
|
|
|
throw new ServiceException(ExceptionCons.NOT_FOUNT_DEF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String message = bo.getMessage();
|
|
|
|
String message = bo.getMessage();
|
|
|
|
|
|
|
|
String userIdStr = LoginHelper.getUserIdStr();
|
|
|
|
BusinessStatusEnum.checkCancelStatus(instance.getFlowStatus());
|
|
|
|
BusinessStatusEnum.checkCancelStatus(instance.getFlowStatus());
|
|
|
|
String applyNodeCode = flwCommonService.applyNodeCode(definition.getId());
|
|
|
|
FlowParams flowParams = FlowParams.build()
|
|
|
|
//撤销
|
|
|
|
.message(message)
|
|
|
|
flwCommonService.backTask(message, instance.getId(), applyNodeCode, BusinessStatusEnum.CANCEL.getStatus(), BusinessStatusEnum.CANCEL.getStatus());
|
|
|
|
.skipType(SkipType.PASS.getKey())
|
|
|
|
//判断或签节点是否有多个,只保留一个
|
|
|
|
.flowStatus(BusinessStatusEnum.CANCEL.getStatus())
|
|
|
|
List<Task> currentTaskList = taskService.list(FlowEngine.newTask().setInstanceId(instance.getId()));
|
|
|
|
.hisStatus(BusinessStatusEnum.CANCEL.getStatus())
|
|
|
|
if (CollUtil.isNotEmpty(currentTaskList)) {
|
|
|
|
.handler(userIdStr)
|
|
|
|
if (currentTaskList.size() > 1) {
|
|
|
|
.ignore(true);
|
|
|
|
currentTaskList.remove(0);
|
|
|
|
taskService.revoke(instance.getId(), flowParams);
|
|
|
|
flwCommonService.deleteRunTask(StreamUtils.toList(currentTaskList, Task::getId));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
log.error("撤销失败: {}", e.getMessage(), e);
|
|
|
|
log.error("撤销失败: {}", e.getMessage(), e);
|
|
|
|
throw new ServiceException(e.getMessage());
|
|
|
|
throw new ServiceException(e.getMessage());
|
|
|
|
@ -363,7 +360,7 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|
|
|
public void setVariable(Long instanceId, Map<String, Object> variable) {
|
|
|
|
public void setVariable(Long instanceId, Map<String, Object> variable) {
|
|
|
|
Instance instance = insService.getById(instanceId);
|
|
|
|
Instance instance = insService.getById(instanceId);
|
|
|
|
if (instance != null) {
|
|
|
|
if (instance != null) {
|
|
|
|
taskService.mergeVariable(instance, variable);
|
|
|
|
flwCommonService.mergeVariable(instance, variable);
|
|
|
|
insService.updateById(instance);
|
|
|
|
insService.updateById(instance);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|