|
|
@@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.jeeplus.common.TokenProvider;
|
|
|
import com.jeeplus.flowable.constant.FlowableConstant;
|
|
|
+import com.jeeplus.flowable.model.FlowDTO;
|
|
|
import com.jeeplus.flowable.model.TaskComment;
|
|
|
import com.jeeplus.flowable.service.converter.json.FlowModelService;
|
|
|
import com.jeeplus.flowable.utils.StringUtils;
|
|
|
@@ -19,8 +20,10 @@ import com.jeeplus.flowable.vo.ActionType;
|
|
|
import com.jeeplus.flowable.vo.ProcessStatus;
|
|
|
import com.jeeplus.flowable.vo.ProcessVo;
|
|
|
import com.jeeplus.flowable.vo.TaskVo;
|
|
|
+import com.jeeplus.sys.feign.IOfficeApi;
|
|
|
import com.jeeplus.sys.feign.ITenantApi;
|
|
|
import com.jeeplus.sys.feign.IUserApi;
|
|
|
+import com.jeeplus.sys.service.dto.OfficeDTO;
|
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
@@ -190,7 +193,14 @@ public class FlowProcessService {
|
|
|
/**
|
|
|
* 运行中的流程
|
|
|
*/
|
|
|
- public Page <ProcessVo> runningList(Page <ProcessInstance> page, String title, String procInsId, String procDefKey) throws Exception {
|
|
|
+ public Page <ProcessVo> runningList(Page <ProcessInstance> page, FlowDTO flowDTO) throws Exception {
|
|
|
+ String procInsId = flowDTO.getProcInsId();
|
|
|
+ String procDefKey = flowDTO.getProcDefKe();
|
|
|
+ String title = flowDTO.getTitle();
|
|
|
+ String userName = flowDTO.getUserName();
|
|
|
+ String userId = flowDTO.getUserId();
|
|
|
+ String processDefinitionName = flowDTO.getProcessDefinitionName();
|
|
|
+
|
|
|
List <ProcessVo> result = new ArrayList <ProcessVo> ( );
|
|
|
Page <ProcessVo> resultPage = new Page <> ( );
|
|
|
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery ( ).processInstanceTenantId ( tenantApi.getCurrentTenantId ( ) ).includeProcessVariables ( );
|
|
|
@@ -203,10 +213,22 @@ public class FlowProcessService {
|
|
|
processInstanceQuery.processDefinitionKey ( procDefKey );
|
|
|
}
|
|
|
|
|
|
+ if ( StrUtil.isNotBlank ( processDefinitionName ) ) {
|
|
|
+ processInstanceQuery.processDefinitionName ( processDefinitionName );
|
|
|
+ }
|
|
|
+
|
|
|
if ( StrUtil.isNotBlank ( title ) ) {
|
|
|
processInstanceQuery.variableValueLike ( "title", "%" + title + "%" );
|
|
|
}
|
|
|
|
|
|
+ if ( StrUtil.isNotBlank ( userId ) ) {
|
|
|
+ processInstanceQuery.variableValueEquals ( "applyUserId", userId );
|
|
|
+ }else{
|
|
|
+ if ( StrUtil.isNotBlank ( userName ) ) {
|
|
|
+ processInstanceQuery.variableValueLike ( "userName", "%" + userName + "%" );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
page.setTotal ( processInstanceQuery.count ( ) );
|
|
|
resultPage.setTotal ( processInstanceQuery.count ( ) );
|
|
|
|
|
|
@@ -225,7 +247,7 @@ public class FlowProcessService {
|
|
|
processVo.setProcessDefinitionId ( p.getProcessDefinitionId ( ) );
|
|
|
processVo.setProcessDefinitionName ( p.getProcessDefinitionName ( ) );
|
|
|
processVo.setActivityId ( p.getActivityId ( ) );
|
|
|
- processVo.setVars ( p.getProcessVariables ( ) );
|
|
|
+ processVo.setVars ( p.getProcessVariables() );
|
|
|
result.add ( processVo );
|
|
|
}
|
|
|
resultPage.setRecords ( result );
|
|
|
@@ -236,18 +258,34 @@ public class FlowProcessService {
|
|
|
/**
|
|
|
* 已结束的流程
|
|
|
*/
|
|
|
- public Page <ProcessVo> historyList(Page <ProcessVo> page, String title, String procInsId, String procDefKey) throws Exception {
|
|
|
-
|
|
|
+ public Page <ProcessVo> historyList(Page <ProcessVo> page, FlowDTO flowDTO) throws Exception {
|
|
|
+ String procInsId = flowDTO.getProcInsId();
|
|
|
+ String procDefKey = flowDTO.getProcDefKe();
|
|
|
+ String title = flowDTO.getTitle();
|
|
|
+ String userId = flowDTO.getUserId();
|
|
|
+ String userName = flowDTO.getUserName();
|
|
|
+ String processDefinitionName = flowDTO.getProcessDefinitionName();
|
|
|
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery ( ).processInstanceTenantId ( tenantApi.getCurrentTenantId ( ) ).includeProcessVariables ( ).finished ( )
|
|
|
.orderByProcessInstanceEndTime ( ).desc ( );
|
|
|
|
|
|
if ( StrUtil.isNotBlank ( procInsId ) ) {
|
|
|
query.processInstanceId ( procInsId );
|
|
|
}
|
|
|
+
|
|
|
+ if ( StrUtil.isNotBlank ( processDefinitionName ) ) {
|
|
|
+ query.processDefinitionName ( processDefinitionName );
|
|
|
+ }
|
|
|
+
|
|
|
if ( StrUtil.isNotBlank ( title ) ) {
|
|
|
query.variableValueLike ( "title", "%" + title + "%" );
|
|
|
}
|
|
|
-
|
|
|
+ if ( StrUtil.isNotBlank ( userId ) ) {
|
|
|
+ query.variableValueEquals ( "applyUserId", userId );
|
|
|
+ }else{
|
|
|
+ if ( StrUtil.isNotBlank ( userName ) ) {
|
|
|
+ query.variableValueLike ( "userName", "%" + userName + "%" );
|
|
|
+ }
|
|
|
+ }
|
|
|
if ( StrUtil.isNotBlank ( procDefKey ) ) {
|
|
|
query.processDefinitionKey ( procDefKey );
|
|
|
}
|