首页数据修正,添加外出记录模快
This commit is contained in:
@@ -130,4 +130,5 @@ public interface IWfProcessService {
|
||||
*/
|
||||
String commonStart(String category);
|
||||
|
||||
TableDataInfo<WfTaskVo> selectPageTripAndAbsenceProcessList(ProcessQuery processQuery, PageQuery pageQuery);
|
||||
}
|
||||
|
||||
@@ -233,6 +233,85 @@ public class WfProcessServiceImpl extends FlowServiceFactory implements IWfProce
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TableDataInfo<WfTaskVo> selectPageTripAndAbsenceProcessList(ProcessQuery processQuery, PageQuery pageQuery) {
|
||||
// System.out.println("process====" + processQuery);
|
||||
Page<WfTaskVo> page = new Page<>();
|
||||
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery()
|
||||
.processDefinitionCategory("trip")
|
||||
.or()
|
||||
.processDefinitionCategory("absence")
|
||||
.orderByProcessInstanceStartTime()
|
||||
.desc();
|
||||
// 构建搜索条件
|
||||
ProcessUtils.buildProcessSearch(historicProcessInstanceQuery, processQuery);
|
||||
int offset = pageQuery.getPageSize() * (pageQuery.getPageNum() - 1);
|
||||
List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery
|
||||
.listPage(offset, pageQuery.getPageSize());
|
||||
page.setTotal(historicProcessInstanceQuery.count());
|
||||
|
||||
List<WfTaskVo> taskVoList = new ArrayList<>();
|
||||
|
||||
for (HistoricProcessInstance hisIns : historicProcessInstances) {
|
||||
WfTaskVo taskVo = new WfTaskVo();
|
||||
// 获取流程状态
|
||||
HistoricVariableInstance processStatusVariable = historyService.createHistoricVariableInstanceQuery()
|
||||
.processInstanceId(hisIns.getId())
|
||||
.variableName(ProcessConstants.PROCESS_STATUS_KEY)
|
||||
.singleResult();
|
||||
String processStatus = null;
|
||||
if (ObjectUtil.isNotNull(processStatusVariable)) {
|
||||
processStatus = Convert.toStr(processStatusVariable.getValue());
|
||||
}
|
||||
// 兼容旧流程
|
||||
if (processStatus == null) {
|
||||
processStatus = ObjectUtil.isNull(hisIns.getEndTime()) ? ProcessStatus.RUNNING.getStatus() : ProcessStatus.COMPLETED.getStatus();
|
||||
}
|
||||
taskVo.setProcessStatus(processStatus);
|
||||
taskVo.setCreateTime(hisIns.getStartTime());
|
||||
taskVo.setFinishTime(hisIns.getEndTime());
|
||||
taskVo.setProcInsId(hisIns.getId());
|
||||
|
||||
// 计算耗时
|
||||
if (Objects.nonNull(hisIns.getEndTime())) {
|
||||
taskVo.setDuration(DateUtils.getDatePoor(hisIns.getEndTime(), hisIns.getStartTime()));
|
||||
} else {
|
||||
taskVo.setDuration(DateUtils.getDatePoor(DateUtils.getNowDate(), hisIns.getStartTime()));
|
||||
}
|
||||
// 流程部署实例信息
|
||||
Deployment deployment = repositoryService.createDeploymentQuery()
|
||||
.deploymentId(hisIns.getDeploymentId()).singleResult();
|
||||
taskVo.setDeployId(hisIns.getDeploymentId());
|
||||
taskVo.setProcDefId(hisIns.getProcessDefinitionId());
|
||||
taskVo.setProcDefName(hisIns.getProcessDefinitionName());
|
||||
taskVo.setProcDefVersion(hisIns.getProcessDefinitionVersion());
|
||||
taskVo.setCategory(deployment.getCategory());
|
||||
|
||||
// 当前所处流程
|
||||
List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).includeIdentityLinks().list();
|
||||
if (CollUtil.isNotEmpty(taskList)) {
|
||||
taskVo.setTaskName(taskList.stream().map(Task::getName).filter(StringUtils::isNotEmpty).collect(Collectors.joining(",")));
|
||||
}
|
||||
//taskVo.setProcVars(hisIns.getProcessVariables());
|
||||
// 查询任务节点参数,并转换成Map,目的是获取流程标题(新增于2024年2月29日)
|
||||
List<HistoricVariableInstance> collectors = historyService.createHistoricVariableInstanceQuery().processInstanceId(hisIns.getId()).list();
|
||||
if(CollUtil.isNotEmpty(collectors)){
|
||||
// taskVo.setProcVars(collectors.stream().collect(Collectors.toMap(HistoricVariableInstance::getVariableName, HistoricVariableInstance::getValue)));
|
||||
// 遍历表单属性并获取值
|
||||
collectors.stream().forEach(historicVariableInstance -> {
|
||||
if (historicVariableInstance.getVariableName().equals("description")) {
|
||||
taskVo.setProcVars(historicVariableInstance.getValue());
|
||||
}
|
||||
});
|
||||
}
|
||||
taskVoList.add(taskVo);
|
||||
}
|
||||
page.setRecords(taskVoList);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<WfTaskVo> selectOwnProcessList(ProcessQuery processQuery) {
|
||||
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery()
|
||||
|
||||
Reference in New Issue
Block a user