|
|
|
@ -2,8 +2,10 @@ package com.ruoyi.flowable.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DatePattern;
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
@ -237,11 +239,9 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
} catch (FlowableException e) {
|
|
|
|
|
throw new CustomException("无法取消或开始活动");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
runtimeService.updateBusinessStatus(flowTaskVo.getInstanceId(), FlowStatus.REJECT.getValue());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 退回任务
|
|
|
|
|
*
|
|
|
|
@ -998,23 +998,37 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public AjaxResult updateVariablesSubmitDate(UpdateVariablesSubmitDateVo vo) {
|
|
|
|
|
public AjaxResult updateTaskFinishDate(UpdateVariablesSubmitDateVo vo) {
|
|
|
|
|
if (StringUtils.isBlank(vo.getProcessInstanceId()) || StringUtils.isBlank(vo.getFinishDate())) {
|
|
|
|
|
return AjaxResult.error("更新提交时间失败,参数无效");
|
|
|
|
|
}
|
|
|
|
|
Execution execution = runtimeService.createExecutionQuery().processInstanceId(vo.getProcessInstanceId()).variableExists("submitDate").singleResult();
|
|
|
|
|
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(vo.getProcessInstanceId()).includeProcessVariables().singleResult();
|
|
|
|
|
if (Objects.isNull(execution)) {
|
|
|
|
|
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(vo.getProcessInstanceId()).taskId(vo.getTaskId()).singleResult();
|
|
|
|
|
if (Objects.isNull(historicTaskInstance)) {
|
|
|
|
|
return AjaxResult.error("更新提交时间失败,此任务不存在");
|
|
|
|
|
}
|
|
|
|
|
String executionId = historicTaskInstance.getExecutionId();
|
|
|
|
|
if (Objects.isNull(executionId)) {
|
|
|
|
|
return AjaxResult.error("更新提交时间失败,查询错误");
|
|
|
|
|
}
|
|
|
|
|
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(vo.getProcessInstanceId()).includeProcessVariables().singleResult();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> variables = processInstance.getProcessVariables();
|
|
|
|
|
Map<String, Object> map = (Map<String , Object>)MapUtils.getMap(variables, USER_MODIFY_TASK_FINISH_TIME_VARIABLE_KEY,new HashMap<>());
|
|
|
|
|
map.put(vo.getTaskId(), DateUtil.parse(vo.getFinishDate(), DatePattern.NORM_DATETIME_FORMATTER));
|
|
|
|
|
runtimeService.setVariable(execution.getId(),USER_MODIFY_TASK_FINISH_TIME_VARIABLE_KEY,map);
|
|
|
|
|
|
|
|
|
|
DateTime submitDate = DateUtil.parse(vo.getFinishDate(), DatePattern.NORM_DATETIME_FORMATTER);
|
|
|
|
|
map.put(vo.getTaskId(),submitDate);
|
|
|
|
|
runtimeService.setVariable(vo.getProcessInstanceId(), USER_MODIFY_TASK_FINISH_TIME_VARIABLE_KEY,map);
|
|
|
|
|
updateSubmitDate(vo.getProcessInstanceId(), historicTaskInstance.getName(), submitDate);
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void updateSubmitDate( String processInstanceId,String taskName, DateTime submitDate) {
|
|
|
|
|
if (ObjectUtil.notEqual("提交汇报",taskName)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
runtimeService.setVariable(processInstanceId,"submitDate",submitDate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取下一节点
|
|
|
|
|
*
|
|
|
|
|