提交 f0e41b82 authored 作者: hzh's avatar hzh

代码优化

上级 f6b5db30
...@@ -30,4 +30,9 @@ public class TaskBo implements Serializable { ...@@ -30,4 +30,9 @@ public class TaskBo implements Serializable {
* 流程定义key * 流程定义key
*/ */
private String processDefinitionKey; private String processDefinitionKey;
/**
* 表名
*/
private String tableName;
} }
...@@ -7,6 +7,7 @@ import org.dromara.common.translation.constant.TransConstant; ...@@ -7,6 +7,7 @@ import org.dromara.common.translation.constant.TransConstant;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Map;
/** /**
* 任务视图 * 任务视图
...@@ -170,4 +171,9 @@ public class TaskVo implements Serializable { ...@@ -170,4 +171,9 @@ public class TaskVo implements Serializable {
* 节点配置 * 节点配置
*/ */
private WfNodeConfigVo wfNodeConfigVo; private WfNodeConfigVo wfNodeConfigVo;
/**
* 流程变量,前端会提交一个元素{'entity': {业务详情数据对象}}
*/
private Map<String, Object> variables;
} }
...@@ -24,6 +24,7 @@ import org.dromara.system.api.model.RoleDTO; ...@@ -24,6 +24,7 @@ import org.dromara.system.api.model.RoleDTO;
import org.dromara.workflow.common.constant.FlowConstant; import org.dromara.workflow.common.constant.FlowConstant;
import org.dromara.workflow.common.enums.TaskStatusEnum; import org.dromara.workflow.common.enums.TaskStatusEnum;
import org.dromara.workflow.domain.ActHiTaskinst; import org.dromara.workflow.domain.ActHiTaskinst;
import org.dromara.workflow.domain.WfDefinitionConfig;
import org.dromara.workflow.domain.WfTaskBackNode; import org.dromara.workflow.domain.WfTaskBackNode;
import org.dromara.workflow.domain.bo.*; import org.dromara.workflow.domain.bo.*;
import org.dromara.workflow.domain.vo.*; import org.dromara.workflow.domain.vo.*;
...@@ -31,6 +32,7 @@ import org.dromara.workflow.flowable.cmd.*; ...@@ -31,6 +32,7 @@ import org.dromara.workflow.flowable.cmd.*;
import org.dromara.workflow.flowable.handler.FlowProcessEventHandler; import org.dromara.workflow.flowable.handler.FlowProcessEventHandler;
import org.dromara.workflow.mapper.ActHiTaskinstMapper; import org.dromara.workflow.mapper.ActHiTaskinstMapper;
import org.dromara.workflow.mapper.ActTaskMapper; import org.dromara.workflow.mapper.ActTaskMapper;
import org.dromara.workflow.mapper.WfDefinitionConfigMapper;
import org.dromara.workflow.service.IActTaskService; import org.dromara.workflow.service.IActTaskService;
import org.dromara.workflow.service.IWfDefinitionConfigService; import org.dromara.workflow.service.IWfDefinitionConfigService;
import org.dromara.workflow.service.IWfNodeConfigService; import org.dromara.workflow.service.IWfNodeConfigService;
...@@ -89,6 +91,7 @@ public class ActTaskServiceImpl implements IActTaskService { ...@@ -89,6 +91,7 @@ public class ActTaskServiceImpl implements IActTaskService {
private final IWfNodeConfigService wfNodeConfigService; private final IWfNodeConfigService wfNodeConfigService;
private final IWfDefinitionConfigService wfDefinitionConfigService; private final IWfDefinitionConfigService wfDefinitionConfigService;
private final FlowProcessEventHandler flowProcessEventHandler; private final FlowProcessEventHandler flowProcessEventHandler;
private final WfDefinitionConfigMapper wfDefinitionConfigMapper;
@DubboReference @DubboReference
private RemoteUserService remoteUserService; private RemoteUserService remoteUserService;
@DubboReference @DubboReference
...@@ -276,15 +279,17 @@ public class ActTaskServiceImpl implements IActTaskService { ...@@ -276,15 +279,17 @@ public class ActTaskServiceImpl implements IActTaskService {
queryWrapper.eq(TenantHelper.isEnable(), "t.tenant_id_", TenantHelper.getTenantId()); queryWrapper.eq(TenantHelper.isEnable(), "t.tenant_id_", TenantHelper.getTenantId());
String ids = StreamUtils.join(roleIds, x -> "'" + x + "'"); String ids = StreamUtils.join(roleIds, x -> "'" + x + "'");
queryWrapper.and(w1 -> w1.eq("t.assignee_", userId).or(w2 -> w2.isNull("t.assignee_").apply("exists ( select LINK.ID_ from ACT_RU_IDENTITYLINK LINK where LINK.TASK_ID_ = t.ID_ and LINK.TYPE_ = 'candidate' and (LINK.USER_ID_ = {0} or ( LINK.GROUP_ID_ IN (" + ids + ") ) ))", userId))); queryWrapper.and(w1 -> w1.eq("t.assignee_", userId).or(w2 -> w2.isNull("t.assignee_").apply("exists ( select LINK.ID_ from ACT_RU_IDENTITYLINK LINK where LINK.TASK_ID_ = t.ID_ and LINK.TYPE_ = 'candidate' and (LINK.USER_ID_ = {0} or ( LINK.GROUP_ID_ IN (" + ids + ") ) ))", userId)));
if (StringUtils.isNotBlank(taskBo.getName())) { if (StringUtils.isNotBlank(taskBo.getTableName())) {
queryWrapper.like("t.name_", taskBo.getName()); WfDefinitionConfig wdc = wfDefinitionConfigMapper.selectOne(WfDefinitionConfig::getTableName, taskBo.getTableName());
} if (wdc == null) {
if (StringUtils.isNotBlank(taskBo.getProcessDefinitionName())) { queryWrapper.eq("t.id_", -1);
queryWrapper.like("t.processDefinitionName", taskBo.getProcessDefinitionName()); } else {
} queryWrapper.likeLeft("t.proc_def_id_", wdc.getProcessKey() + ":");
if (StringUtils.isNotBlank(taskBo.getProcessDefinitionKey())) { }
queryWrapper.eq("t.processDefinitionKey", taskBo.getProcessDefinitionKey());
} }
queryWrapper.like(StringUtils.isNotBlank(taskBo.getName()), "t.name_", taskBo.getName());
queryWrapper.like(StringUtils.isNotBlank(taskBo.getProcessDefinitionName()), "t.processDefinitionName", taskBo.getProcessDefinitionName());
queryWrapper.eq(StringUtils.isNotBlank(taskBo.getProcessDefinitionKey()), "t.processDefinitionKey", taskBo.getProcessDefinitionKey());
queryWrapper.orderByDesc("t.CREATE_TIME_"); queryWrapper.orderByDesc("t.CREATE_TIME_");
Page<TaskVo> page = actTaskMapper.getTaskWaitByPage(pageQuery.build(), queryWrapper); Page<TaskVo> page = actTaskMapper.getTaskWaitByPage(pageQuery.build(), queryWrapper);
...@@ -374,6 +379,14 @@ public class ActTaskServiceImpl implements IActTaskService { ...@@ -374,6 +379,14 @@ public class ActTaskServiceImpl implements IActTaskService {
queryWrapper.like(StringUtils.isNotBlank(taskBo.getName()), "t.name_", taskBo.getName()); queryWrapper.like(StringUtils.isNotBlank(taskBo.getName()), "t.name_", taskBo.getName());
queryWrapper.like(StringUtils.isNotBlank(taskBo.getProcessDefinitionName()), "t.processDefinitionName", taskBo.getProcessDefinitionName()); queryWrapper.like(StringUtils.isNotBlank(taskBo.getProcessDefinitionName()), "t.processDefinitionName", taskBo.getProcessDefinitionName());
queryWrapper.eq(StringUtils.isNotBlank(taskBo.getProcessDefinitionKey()), "t.processDefinitionKey", taskBo.getProcessDefinitionKey()); queryWrapper.eq(StringUtils.isNotBlank(taskBo.getProcessDefinitionKey()), "t.processDefinitionKey", taskBo.getProcessDefinitionKey());
if (StringUtils.isNotBlank(taskBo.getTableName())) {
WfDefinitionConfig wdc = wfDefinitionConfigMapper.selectOne(WfDefinitionConfig::getTableName, taskBo.getTableName());
if (wdc == null) {
queryWrapper.eq("t.id_", -1);
} else {
queryWrapper.likeLeft("t.proc_def_id_", wdc.getProcessKey() + ":");
}
}
queryWrapper.eq("t.assignee_", userId); queryWrapper.eq("t.assignee_", userId);
Page<TaskVo> page = actTaskMapper.getTaskFinishByPage(pageQuery.build(), queryWrapper); Page<TaskVo> page = actTaskMapper.getTaskFinishByPage(pageQuery.build(), queryWrapper);
...@@ -401,14 +414,16 @@ public class ActTaskServiceImpl implements IActTaskService { ...@@ -401,14 +414,16 @@ public class ActTaskServiceImpl implements IActTaskService {
public TableDataInfo<TaskVo> getPageByTaskCopy(TaskBo taskBo, PageQuery pageQuery) { public TableDataInfo<TaskVo> getPageByTaskCopy(TaskBo taskBo, PageQuery pageQuery) {
QueryWrapper<TaskVo> queryWrapper = new QueryWrapper<>(); QueryWrapper<TaskVo> queryWrapper = new QueryWrapper<>();
String userId = String.valueOf(LoginHelper.getUserId()); String userId = String.valueOf(LoginHelper.getUserId());
if (StringUtils.isNotBlank(taskBo.getName())) { queryWrapper.like(StringUtils.isNotBlank(taskBo.getName()), "t.name_", taskBo.getName());
queryWrapper.like("t.name_", taskBo.getName()); queryWrapper.like(StringUtils.isNotBlank(taskBo.getProcessDefinitionName()), "t.processDefinitionName", taskBo.getProcessDefinitionName());
} queryWrapper.eq(StringUtils.isNotBlank(taskBo.getProcessDefinitionKey()), "t.processDefinitionKey", taskBo.getProcessDefinitionKey());
if (StringUtils.isNotBlank(taskBo.getProcessDefinitionName())) { if (StringUtils.isNotBlank(taskBo.getTableName())) {
queryWrapper.like("t.processDefinitionName", taskBo.getProcessDefinitionName()); WfDefinitionConfig wdc = wfDefinitionConfigMapper.selectOne(WfDefinitionConfig::getTableName, taskBo.getTableName());
} if (wdc == null) {
if (StringUtils.isNotBlank(taskBo.getProcessDefinitionKey())) { queryWrapper.eq("t.id_", -1);
queryWrapper.eq("t.processDefinitionKey", taskBo.getProcessDefinitionKey()); } else {
queryWrapper.likeLeft("t.proc_def_id_", wdc.getProcessKey() + ":");
}
} }
queryWrapper.eq("t.assignee_", userId); queryWrapper.eq("t.assignee_", userId);
Page<TaskVo> page = actTaskMapper.getTaskCopyByPage(pageQuery.build(), queryWrapper); Page<TaskVo> page = actTaskMapper.getTaskCopyByPage(pageQuery.build(), queryWrapper);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论