提交 e78ace6d 编写于 作者: tangyaolong's avatar tangyaolong

完善逻辑

上级 4a189ed9
......@@ -41,6 +41,7 @@ import org.flowable.identitylink.api.IdentityLink;
import org.flowable.task.api.DelegationState;
import org.flowable.task.api.Task;
import org.flowable.task.api.TaskQuery;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.service.impl.persistence.entity.HistoricTaskInstanceEntity;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.flowable.ui.common.security.SecurityUtils;
......@@ -1919,8 +1920,6 @@ public class WFCoreService
* @return 回退上一个节点
*/
public boolean wfback(String taskId) {
try {
String sourceRef = null;
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String taskDefinitionKey = task.getTaskDefinitionKey();
if (taskDefinitionKey == null) {
......@@ -1932,17 +1931,13 @@ public class WFCoreService
log.debug("processInstanceId不存在");
return false;
}
Map taskMap = new HashMap();
taskMap.put("processInstanceId",processInstanceId);
Map process = wfCoreMapper.serchSubProcess(taskMap);
if(process.size() == 1){
sourceRef = process.get("processInstanceId").toString();
runtimeService.createChangeActivityStateBuilder().processInstanceId(processInstanceId).moveActivityIdTo(taskDefinitionKey, sourceRef).changeState();
return true;
}
} catch (Exception e) {
throw new BadRequestAlertException("回退失败","WFCoreService","wfback");
List<HistoricTaskInstance> history = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).orderByHistoricTaskInstanceEndTime().desc().list();
if(ObjectUtils.isEmpty(history)){
throw new BadRequestAlertException("暂无流程数据","WFCoreService","wfback");
}
return false;
HistoricTaskInstance sourceRef = history.get(0);
// 执行回退
runtimeService.createChangeActivityStateBuilder().processInstanceId(processInstanceId).moveActivityIdTo(taskDefinitionKey, sourceRef.getTaskDefinitionKey()).changeState();
return true;
}
}
......@@ -24,6 +24,4 @@ public interface WFCoreMapper {
Page<WFTask> searchUnReadTask(IPage page, @Param("srf") WFTaskSearchContext context, @Param("ew") Wrapper<WFTask> wrapper) ;
Object readTask(@Param("et")Map param);
Map serchSubProcess(@Param("et")Map param);
}
......@@ -30,12 +30,6 @@
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<select id="serchSubProcess" parameterType="cn.ibizlab.core.workflow.filter.WFTaskSearchContext" resultType="java.util.Map">
select TASK_DEF_KEY_ as taskDefinitionKey from ACT_HI_TASKINST where PROC_INST_ID_ = #{et.processInstanceId} and END_TIME_ is not null and DELETE_REASON_ is null order by END_TIME_ desc
</select>
<select id="searchMyTaskCnt" parameterType="cn.ibizlab.core.workflow.filter.WFTaskSearchContext" resultType="cn.ibizlab.core.workflow.domain.WFProcessNode">
select t.ProcessDefinitionKey,max(t.ProcessDefinitionName) as ProcessDefinitionName,
t.TaskDefinitionKey as UserTaskId,t.Name as UserTaskName,max(t.version) as version ,count(1) as Cnt from
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册