| | |
| | | import org.flowable.engine.history.HistoricProcessInstance; |
| | | import org.springframework.stereotype.Service; |
| | | /** |
| | | * 程序节点 |
| | | * 程序流程装填查询 |
| | | * |
| | | * @author yangys |
| | | */ |
| | |
| | | @AllArgsConstructor |
| | | public class ProgramFlowStatusQueryService { |
| | | private final HistoryService historyService; |
| | | public static final int STATUS_NONE = 0; |
| | | public static final int STATUS_PROCESSING = 1; |
| | | public static final int STATUS_FINISHED = 2; |
| | | public int queryFlowStatus(String processInstanceId) { |
| | | if(processInstanceId == null){ |
| | | return 0; |
| | | return STATUS_NONE; |
| | | } |
| | | int status; |
| | | HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() |
| | |
| | | |
| | | if (historicProcessInstance != null && historicProcessInstance.getEndTime() != null) { |
| | | // 流程已完成 |
| | | status = 2; //已通过,有无驳回呢? |
| | | //检查最后一个审批结果,如果时N,那就时驳回了status = =3; |
| | | status = STATUS_FINISHED; //完成 |
| | | } else { |
| | | // 流程未完成 |
| | | status = 1; |
| | | status = STATUS_PROCESSING; |
| | | } |
| | | return status; |
| | | } |