优化项目
This commit is contained in:
parent
8ff2486ac1
commit
3c13b5cf5c
|
@ -138,7 +138,7 @@ public class FlowController extends BaseController {
|
|||
return prefix+"/myTakePartInProcess";
|
||||
}
|
||||
/**
|
||||
* 获取我的流程实例
|
||||
* 获取我办结的任务列表
|
||||
* @param historicTaskInstanceDTO
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.snow.common.constant.SequenceContants;
|
||||
import com.snow.common.enums.WorkRecordStatus;
|
||||
import com.snow.common.utils.StringUtils;
|
||||
import com.snow.flowable.common.constants.FlowConstants;
|
||||
import com.snow.flowable.domain.*;
|
||||
|
@ -197,7 +198,7 @@ public class SysOaLeaveController extends BaseController
|
|||
HistoricTaskInstanceDTO historicTaskInstanceDTO=new HistoricTaskInstanceDTO();
|
||||
historicTaskInstanceDTO.setBusinessKey(sysOaLeave.getLeaveNo());
|
||||
historicTaskInstanceDTO.setProcessInstanceId(sysOaLeave.getProcessInstanceId());
|
||||
historicTaskInstanceDTO.setProcessStatus(1);
|
||||
historicTaskInstanceDTO.setProcessStatus(WorkRecordStatus.FINISHED);
|
||||
List<HistoricTaskInstanceVO> historicTaskInstanceList= flowableService.getHistoricTaskInstanceNoPage(historicTaskInstanceDTO);
|
||||
String spendTime = DateUtil.formatBetween(sysOaLeave.getStartTime(), sysOaLeave.getEndTime(), BetweenFormater.Level.SECOND);
|
||||
sysOaLeave.setLeaveTime(spendTime);
|
||||
|
|
|
@ -60,13 +60,17 @@
|
|||
title: '流程名称'
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
field: 'taskName',
|
||||
title: '任务名称'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'businessKey',
|
||||
title: '单号'
|
||||
title: '单号',
|
||||
formatter: function(value, row, index) {
|
||||
var fromDetailUrl= row.fromDetailUrl;
|
||||
return '<a class="success" href="' + fromDetailUrl+ '" target="_blank">'+value+'</a> ';
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
|
@ -79,7 +83,7 @@
|
|||
title: '完成时间'
|
||||
},
|
||||
{
|
||||
field: 'spendTime',
|
||||
field: 'handleTaskTime',
|
||||
title: '任务耗时'
|
||||
},
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.snow.flowable.common.enums;
|
||||
|
||||
/**
|
||||
* @program: snow
|
||||
* @description
|
||||
* @author: 没用的阿吉
|
||||
* @create: 2020-12-13 19:54
|
||||
**/
|
||||
public enum FlowStatusEnum {
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.snow.flowable.domain;
|
||||
|
||||
import com.snow.common.enums.WorkRecordStatus;
|
||||
import com.snow.flowable.enums.FlowFinishedStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -91,11 +92,16 @@ public class HistoricTaskInstanceDTO extends FlowBaseDTO implements Serializabl
|
|||
/**
|
||||
* 流程状态(0--进行中,1-结束)
|
||||
*/
|
||||
private Integer processStatus;
|
||||
private WorkRecordStatus processStatus;
|
||||
|
||||
/**
|
||||
* 任务状态(0--进行中,1--结束)
|
||||
*/
|
||||
private WorkRecordStatus taskStatus;
|
||||
|
||||
private Date dueDate;
|
||||
|
||||
|
||||
|
||||
|
||||
private String category;
|
||||
|
||||
|
|
|
@ -94,8 +94,11 @@ public class HistoricTaskInstanceVO extends TaskVO implements Serializable {
|
|||
private String owner;
|
||||
|
||||
|
||||
private String fromDetailUrl;
|
||||
|
||||
|
||||
private AppForm appForm;
|
||||
|
||||
|
||||
private int priority;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.google.common.collect.Lists;
|
|||
import com.google.common.collect.Maps;
|
||||
import com.snow.common.core.page.PageModel;
|
||||
import com.snow.common.core.text.Convert;
|
||||
import com.snow.common.enums.WorkRecordStatus;
|
||||
import com.snow.common.exception.BusinessException;
|
||||
import com.snow.flowable.common.constants.FlowConstants;
|
||||
import com.snow.flowable.config.ICustomProcessDiagramGenerator;
|
||||
|
@ -594,13 +595,14 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
}
|
||||
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getProcessStatus())){
|
||||
Integer processStatus= historicTaskInstanceDTO.getProcessStatus();
|
||||
if(processStatus==FlowFinishedStatusEnum.FLOW_ING.getCode()){
|
||||
WorkRecordStatus workRecordStatus=historicTaskInstanceDTO.getProcessStatus();
|
||||
if( workRecordStatus.equals(WorkRecordStatus.NO_FINISHED)){
|
||||
historicTaskInstanceQuery.unfinished();
|
||||
}else if(processStatus==FlowFinishedStatusEnum.FLOW_FINISHED.getCode()){
|
||||
}else if(workRecordStatus.equals(WorkRecordStatus.FINISHED)){
|
||||
historicTaskInstanceQuery.finished();
|
||||
}
|
||||
}
|
||||
|
||||
historicTaskInstanceQuery.includeTaskLocalVariables().includeProcessVariables().includeIdentityLinks();
|
||||
List<HistoricTaskInstance> list = historicTaskInstanceQuery.orderByTaskCreateTime().asc().list();
|
||||
List<HistoricTaskInstanceVO> historicTaskInstanceVOS = HistoricTaskInstanceVO.warpList(list);
|
||||
|
@ -768,18 +770,42 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
@Override
|
||||
public PageModel<HistoricTaskInstanceVO> getHistoricTaskInstance(HistoricTaskInstanceDTO historicTaskInstanceDTO) {
|
||||
HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery();
|
||||
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getProcessDefinitionName())){
|
||||
historicTaskInstanceQuery.processDefinitionName(historicTaskInstanceDTO.getProcessDefinitionName());
|
||||
}
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getUserId())){
|
||||
historicTaskInstanceQuery.taskAssignee(historicTaskInstanceDTO.getUserId());
|
||||
//只能判断null,不能判断""
|
||||
Optional.ofNullable(historicTaskInstanceDTO.getUserId()).ifPresent(
|
||||
userId-> {
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceQuery.taskAssignee(userId))){
|
||||
historicTaskInstanceQuery.taskAssignee(userId);
|
||||
}
|
||||
}
|
||||
);
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getBusinessKeyLike())){
|
||||
historicTaskInstanceQuery.processInstanceBusinessKeyLike(historicTaskInstanceDTO.getBusinessKeyLike());
|
||||
}
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getBusinessKey())){
|
||||
historicTaskInstanceQuery.processInstanceBusinessKey(historicTaskInstanceDTO.getBusinessKey());
|
||||
}
|
||||
if(!StringUtils.isEmpty(historicTaskInstanceDTO.getBusinessKeyLike())){
|
||||
historicTaskInstanceQuery.processInstanceBusinessKeyLike(historicTaskInstanceDTO.getBusinessKeyLike());
|
||||
}
|
||||
Optional.ofNullable(historicTaskInstanceDTO.getTaskStatus()).ifPresent(m->{
|
||||
if(m.equals(WorkRecordStatus.NO_FINISHED)){
|
||||
historicTaskInstanceQuery.unfinished();
|
||||
}
|
||||
if(m.equals(WorkRecordStatus.FINISHED)){
|
||||
historicTaskInstanceQuery.finished();
|
||||
}
|
||||
});
|
||||
|
||||
Optional.ofNullable(historicTaskInstanceDTO.getProcessStatus()).ifPresent(m->{
|
||||
if(m.equals(WorkRecordStatus.NO_FINISHED)){
|
||||
historicTaskInstanceQuery.processUnfinished();
|
||||
}
|
||||
if(m.equals(WorkRecordStatus.FINISHED)){
|
||||
historicTaskInstanceQuery.processFinished();
|
||||
}
|
||||
});
|
||||
historicTaskInstanceQuery.includeIdentityLinks().includeProcessVariables().includeTaskLocalVariables();
|
||||
long count = historicTaskInstanceQuery.orderByHistoricTaskInstanceStartTime().
|
||||
desc().
|
||||
count();
|
||||
|
@ -795,8 +821,18 @@ public class FlowableServiceImpl implements FlowableService {
|
|||
SysUser sysUser = sysUserService.selectUserById(Long.parseLong(t.getAssignee()));
|
||||
historicTaskInstanceVO.setAssignee(sysUser.getUserName());
|
||||
}
|
||||
Map<String, Object> processVariables = t.getProcessVariables();
|
||||
String url= Optional.ofNullable(String.valueOf(processVariables.get(FlowConstants.BUS_VAR_URL))).orElse("");
|
||||
if(!StringUtils.isEmpty(url)){
|
||||
historicTaskInstanceVO.setFromDetailUrl(url+"?processInstanceId="+t.getProcessInstanceId());
|
||||
}
|
||||
AppForm appForm=(AppForm)processVariables.get(FlowConstants.APP_FORM);
|
||||
historicTaskInstanceVO.setAppForm(appForm);
|
||||
historicTaskInstanceVO.setCompleteTime(t.getEndTime());
|
||||
String spendTime = DateUtil.formatBetween(DateUtil.between(t.getCreateTime(), t.getEndTime(), DateUnit.SECOND));
|
||||
historicTaskInstanceVO.setHandleTaskTime(spendTime);
|
||||
historicTaskInstanceVO.setTaskId(t.getId());
|
||||
historicTaskInstanceVO.setTaskName(t.getName());
|
||||
HistoricProcessInstance historicProcessInstance = getHistoricProcessInstanceById(t.getProcessInstanceId());
|
||||
historicTaskInstanceVO.setProcessName(historicProcessInstance.getProcessDefinitionName());
|
||||
historicTaskInstanceVO.setBusinessKey(historicProcessInstance.getBusinessKey());
|
||||
|
|
Loading…
Reference in New Issue