包头 1待催办2已办结(只有PASS)
This commit is contained in:
parent
0488b6b42d
commit
3b0e172621
@ -0,0 +1,13 @@
|
||||
package com.wflow.workflow.bean.process;
|
||||
|
||||
/**
|
||||
* 流程实例状态
|
||||
* @author : willian fu
|
||||
* @since : 2024/5/5
|
||||
*/
|
||||
public enum ProcessStatus {
|
||||
PASS, //审批通过
|
||||
PRE_RUNNING, //进行中
|
||||
PRE_REFUSE, //审批被驳回
|
||||
PRE_CANCEL //审批撤销
|
||||
}
|
||||
@ -1,16 +1,15 @@
|
||||
package com.wflow.workflow.config.listener;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.wflow.exception.BusinessException;
|
||||
import com.wflow.workflow.bean.dto.NotifyDto;
|
||||
import com.wflow.workflow.bean.process.ProcessStatus;
|
||||
import com.wflow.workflow.execute.ListenerExecutor;
|
||||
import com.wflow.workflow.service.NotifyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.bpmn.model.EndEvent;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent;
|
||||
import org.flowable.engine.HistoryService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.delegate.event.*;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
@ -104,6 +103,7 @@ public class GlobalTaskListener extends AbstractFlowableEngineEventListener {
|
||||
.content(StrUtil.builder("您提交的审批【",
|
||||
instance.getProcessDefinitionName(), "】已经通过").toString())
|
||||
.build());
|
||||
runtimeService.updateBusinessStatus(event.getProcessInstanceId(), ProcessStatus.PASS.toString());
|
||||
log.info("[{}]审批流程[{}}]通过", instance.getProcessInstanceId(), instance.getProcessDefinitionName());
|
||||
super.processCompleted(event);
|
||||
}
|
||||
@ -116,9 +116,11 @@ public class GlobalTaskListener extends AbstractFlowableEngineEventListener {
|
||||
if (cause instanceof EndEvent){
|
||||
String endNode = ((EndEvent) cause).getId();
|
||||
if ("refuse-end".equals(endNode)){
|
||||
runtimeService.updateBusinessStatus(event.getProcessInstanceId(), ProcessStatus.PRE_REFUSE.toString());
|
||||
log.debug("监听到流程[{}]被驳回", event.getProcessInstanceId());
|
||||
listenerExecutor.doProcessChangeHandler("refuse", event.getProcessInstanceId(), event.getProcessDefinitionId());
|
||||
} else if ("cancel-end".equals(endNode)) {
|
||||
runtimeService.updateBusinessStatus(event.getProcessInstanceId(), ProcessStatus.PRE_CANCEL.toString());
|
||||
listenerExecutor.doProcessChangeHandler("cancel", event.getProcessInstanceId(), event.getProcessDefinitionId());
|
||||
log.debug("监听到流程[{}]被撤销", event.getProcessInstanceId());
|
||||
}
|
||||
|
||||
@ -60,6 +60,7 @@ public class ProcessInstanceController {
|
||||
* @param pageNo 页码
|
||||
* @param code 表单流程ID(流程定义KEY)
|
||||
* @param finished 流程是否已经结束
|
||||
* @param customStatus 1待催办2已办结(只有PASS)
|
||||
* @return 列表数据
|
||||
*/
|
||||
@OperLog(operModul = "审批管理",operType = "获取系统待我处理的流程",operDesc = "获取系统待我处理的流程")
|
||||
@ -72,9 +73,10 @@ public class ProcessInstanceController {
|
||||
@RequestParam(required = false) Boolean finished,
|
||||
@RequestParam(required = false) String fieldId,
|
||||
@RequestParam(required = false) String fieldVal,
|
||||
@RequestParam(required = false) String key) {
|
||||
@RequestParam(required = false) String key,
|
||||
@RequestParam(required = false) Integer customStatus) {
|
||||
return R.ok(processService.getUserSubmittedList(pageSize, pageNo, UserUtil.getLoginUserId(), code,
|
||||
finished, startTimes, keyword, fieldId, fieldVal, key));
|
||||
finished, startTimes, keyword, fieldId, fieldVal, key,customStatus));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,7 +100,7 @@ public class ProcessInstanceController {
|
||||
@RequestParam(required = false) String startUser,
|
||||
@RequestParam(required = false) String key) {
|
||||
return R.ok(processService.getUserSubmittedList(pageSize, pageNo, startUser, code,
|
||||
finished, startTimes, keyword, fieldId, fieldVal, key));
|
||||
finished, startTimes, keyword, fieldId, fieldVal, key, null));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -5,7 +5,6 @@ import com.wflow.workflow.bean.vo.*;
|
||||
import org.flowable.task.api.Task;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author : willian fu
|
||||
@ -25,7 +24,7 @@ public interface ProcessInstanceService {
|
||||
|
||||
Page<ProcessInstanceVo> getUserSubmittedList(Integer pageSize, Integer pageNo, String startUser, String code,
|
||||
Boolean finished, String[] startTimes, String keyword,
|
||||
String fieldId, String fieldVal, String key);
|
||||
String fieldId, String fieldVal, String key, Integer customStatus);
|
||||
|
||||
Page<ProcessInstanceVo> getCcMeInstance(Integer pageSize, Integer pageNo, String code, String[] startTimes,
|
||||
String startUser, Boolean finished, String key);
|
||||
|
||||
@ -2,7 +2,6 @@ package com.wflow.workflow.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
@ -10,7 +9,6 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wflow.bean.do_.DeptDo;
|
||||
import com.wflow.bean.do_.UserDeptDo;
|
||||
import com.wflow.bean.do_.UserDo;
|
||||
import com.wflow.bean.entity.WflowCcTasks;
|
||||
import com.wflow.bean.entity.WflowModelHistorys;
|
||||
@ -18,13 +16,17 @@ import com.wflow.bean.entity.WflowModels;
|
||||
import com.wflow.bean.entity.WflowSubProcess;
|
||||
import com.wflow.bean.vo.UserVo;
|
||||
import com.wflow.exception.BusinessException;
|
||||
import com.wflow.mapper.*;
|
||||
import com.wflow.mapper.WflowCcTasksMapper;
|
||||
import com.wflow.mapper.WflowModelHistorysMapper;
|
||||
import com.wflow.mapper.WflowModelsMapper;
|
||||
import com.wflow.mapper.WflowSubProcessMapper;
|
||||
import com.wflow.service.OrgRepositoryService;
|
||||
import com.wflow.utils.UserUtil;
|
||||
import com.wflow.workflow.bean.dto.ProcessInstanceOwnerDto;
|
||||
import com.wflow.workflow.bean.process.OperationPerm;
|
||||
import com.wflow.workflow.bean.process.OrgUser;
|
||||
import com.wflow.workflow.bean.process.ProcessNode;
|
||||
import com.wflow.workflow.bean.process.ProcessStatus;
|
||||
import com.wflow.workflow.bean.process.enums.ApprovalModeEnum;
|
||||
import com.wflow.workflow.bean.process.enums.NodeTypeEnum;
|
||||
import com.wflow.workflow.bean.process.enums.ProcessResultEnum;
|
||||
@ -36,9 +38,7 @@ import com.wflow.workflow.config.WflowGlobalVarDef;
|
||||
import com.wflow.workflow.service.*;
|
||||
import com.wflow.workflow.utils.Executor;
|
||||
import com.zhgd.xmgl.tenant.TenantContextHolder;
|
||||
import liquibase.pro.packaged.S;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.flowable.common.engine.impl.identity.Authentication;
|
||||
import org.flowable.engine.HistoryService;
|
||||
@ -142,6 +142,7 @@ public class ProcessInstanceServiceImpl implements ProcessInstanceService {
|
||||
taskService.complete(rootTask.getId());
|
||||
}
|
||||
Authentication.setAuthenticatedUserId(null);
|
||||
runtimeService.updateBusinessStatus(processInstance.getProcessInstanceId(), ProcessStatus.PRE_RUNNING.toString());
|
||||
return processInstance.getProcessInstanceId();
|
||||
}
|
||||
|
||||
@ -427,11 +428,14 @@ public class ProcessInstanceServiceImpl implements ProcessInstanceService {
|
||||
|
||||
@Override
|
||||
public Page<ProcessInstanceVo> getUserSubmittedList(Integer pageSize, Integer pageNo, String startUser, String code,
|
||||
Boolean finished, String[] startTimes, String keyword, String fieldId, String fieldVal, String key) {
|
||||
Boolean finished, String[] startTimes, String keyword, String fieldId, String fieldVal, String key, Integer customStatus) {
|
||||
HistoricProcessInstanceQuery instanceQuery = historyService.createHistoricProcessInstanceQuery();
|
||||
//TODO 多租户
|
||||
instanceQuery.processInstanceTenantId(TenantContextHolder.getTenantId());
|
||||
Executor.builder()
|
||||
//customStatus 1待催办2已办结(只有PASS)
|
||||
.ifNotBlankNext(Objects.equals(customStatus, 1) ? "PRE_%" : null, instanceQuery::processInstanceBusinessStatusLike)
|
||||
.ifNotBlankNext(Objects.equals(customStatus, 2) ? ProcessStatus.PASS.toString() : null, instanceQuery::processInstanceBusinessStatus)
|
||||
.ifNotBlankNext(startUser, instanceQuery::startedBy)
|
||||
.ifNotBlankNext(code, instanceQuery::processDefinitionKey)
|
||||
.ifTrueNext(null != startTimes && startTimes.length > 1, () -> {
|
||||
@ -442,10 +446,10 @@ public class ProcessInstanceServiceImpl implements ProcessInstanceService {
|
||||
.ifTrueNext(Boolean.TRUE.equals(finished), instanceQuery::finished)
|
||||
.ifTrueNext(Boolean.FALSE.equals(finished), instanceQuery::unfinished)
|
||||
.ifNotBlankNext(fieldId, id -> {
|
||||
if (StrUtil.isBlank(code)){
|
||||
if (StrUtil.isBlank(code)) {
|
||||
throw new BusinessException("搜索表单值必须先指定表单流程类型");
|
||||
}
|
||||
if (StrUtil.isNotBlank(fieldVal)){
|
||||
if (StrUtil.isNotBlank(fieldVal)) {
|
||||
instanceQuery.variableValueLike(fieldId, "%" + fieldVal + "%");
|
||||
}
|
||||
});
|
||||
@ -491,7 +495,7 @@ public class ProcessInstanceServiceImpl implements ProcessInstanceService {
|
||||
queryWrapper.eq(WflowCcTasks::getCode, code);
|
||||
}
|
||||
List<WflowCcTasks> tasks = ccTasksMapper.selectList(
|
||||
queryWrapper.orderByDesc(WflowCcTasks::getCreateTime));
|
||||
queryWrapper.orderByDesc(WflowCcTasks::getCreateTime));
|
||||
HistoricProcessInstanceQuery instanceQuery = historyService.createHistoricProcessInstanceQuery();
|
||||
//TODO 多租户
|
||||
instanceQuery.processInstanceTenantId(TenantContextHolder.getTenantId());
|
||||
|
||||
@ -6,6 +6,7 @@ import com.wflow.mapper.WflowSubProcessMapper;
|
||||
import com.wflow.utils.BeanUtil;
|
||||
import com.wflow.workflow.bean.dto.ProcessInstanceOwnerDto;
|
||||
import com.wflow.workflow.bean.process.ProcessNode;
|
||||
import com.wflow.workflow.bean.process.ProcessStatus;
|
||||
import com.wflow.workflow.config.WflowGlobalVarDef;
|
||||
import com.wflow.workflow.config.callActivity.WflowCallActivityBehavior;
|
||||
import com.wflow.workflow.service.ProcessNodeCatchService;
|
||||
@ -50,6 +51,7 @@ public class SubProcessInitTask implements JavaDelegate {
|
||||
execution.setVariable("startDept", ownerDto.getOwnerDeptId());
|
||||
//设置节点流程变量缓存
|
||||
execution.setVariable(WflowGlobalVarDef.WFLOW_NODE_PROPS, propsMap);
|
||||
runtimeService.updateBusinessStatus(execution.getProcessInstanceId(), ProcessStatus.PRE_RUNNING.toString());
|
||||
log.info("设置子流程{}流程变量[{}, {}]", execution.getProcessInstanceId(), ownerDto.getOwner(), ownerDto.getOwnerDeptId());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user