|
|
@@ -4,12 +4,14 @@ import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.ningdatech.pmapi.AppTests; |
|
|
|
import com.ningdatech.pmapi.common.constant.BizConst; |
|
|
|
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.entity.Project; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst; |
|
|
|
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; |
|
|
|
import com.ningdatech.pmapi.projectlib.service.IProjectInstService; |
|
|
|
import com.wflow.workflow.bean.dto.TodoCenterListReqDTO; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.flowable.engine.HistoryService; |
|
|
|
import org.flowable.engine.RuntimeService; |
|
|
|
import org.flowable.engine.history.HistoricActivityInstance; |
|
|
@@ -29,6 +31,7 @@ import java.util.stream.Collectors; |
|
|
|
* @Date 2023/2/16 14:44 |
|
|
|
* @Author PoffyZhang |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
public class InstanceTest extends AppTests { |
|
|
|
|
|
|
|
@Autowired |
|
|
@@ -145,4 +148,43 @@ public class InstanceTest extends AppTests { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void test4(){ |
|
|
|
String nodeId = "node_64d1bc4694fc85e4dd1f1b36"; |
|
|
|
|
|
|
|
List<HistoricActivityInstance> hais = historyService.createHistoricActivityInstanceQuery() |
|
|
|
.activityId(nodeId) |
|
|
|
.unfinished() |
|
|
|
.orderByHistoricActivityInstanceStartTime() |
|
|
|
.asc() |
|
|
|
.list(); |
|
|
|
|
|
|
|
log.info("hais :{}",JSON.toJSONString(hais)); |
|
|
|
|
|
|
|
if (CollUtil.isEmpty(hais)) { |
|
|
|
log.info("没有查到 历史实例"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
String instanceId = hais.get(0).getProcessInstanceId(); |
|
|
|
log.info("instanceId :{}",instanceId); |
|
|
|
|
|
|
|
//查询当前未完成的此实例 |
|
|
|
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery() |
|
|
|
.processInstanceId(instanceId) |
|
|
|
.unfinished() |
|
|
|
.singleResult(); |
|
|
|
|
|
|
|
log.info("instance :{}",JSON.toJSONString(instance)); |
|
|
|
if (Objects.isNull(instance)) { |
|
|
|
log.info("没有查到实例 或者 实例已经结束"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
//2.查到 此流程实例的 项目 |
|
|
|
ProjectInst pi = projectInstService.getOne(Wrappers.lambdaQuery(ProjectInst.class) |
|
|
|
.eq(ProjectInst::getInstCode, instanceId) |
|
|
|
.last(BizConst.LIMIT_1)); |
|
|
|
log.info("pi :{}",JSON.toJSONString(pi)); |
|
|
|
} |
|
|
|
} |