add 添加流程表单配置
This commit is contained in:
parent
c6c615308c
commit
6f5a368c86
@ -75,6 +75,11 @@ public interface FlowConstant {
|
||||
*/
|
||||
String PROCESS_INSTANCE_VO = "processInstanceVo";
|
||||
|
||||
/**
|
||||
* 流程表单配置对象
|
||||
*/
|
||||
String WF_FORM_DEFINITION_VO = "wfFormDefinitionVo";
|
||||
|
||||
/**
|
||||
* 流程发起人
|
||||
*/
|
||||
@ -90,6 +95,11 @@ public interface FlowConstant {
|
||||
*/
|
||||
String BUSINESS_KEY = "businessKey";
|
||||
|
||||
/**
|
||||
* 流程定义id
|
||||
*/
|
||||
String PROCESS_DEFINITION_ID = "processDefinitionId";
|
||||
|
||||
/**
|
||||
* 开启跳过表达式变量
|
||||
*/
|
||||
|
@ -0,0 +1,66 @@
|
||||
package org.dromara.workflow.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.workflow.domain.vo.WfFormDefinitionVo;
|
||||
import org.dromara.workflow.domain.bo.WfFormDefinitionBo;
|
||||
import org.dromara.workflow.service.IWfFormDefinitionService;
|
||||
|
||||
/**
|
||||
* 表单配置
|
||||
*
|
||||
* @author gssong
|
||||
* @date 2024-03-18
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/workflow/formDefinition")
|
||||
public class WfFormDefinitionController extends BaseController {
|
||||
|
||||
private final IWfFormDefinitionService wfFormDefinitionService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取表单配置详细信息
|
||||
*
|
||||
* @param definitionId 主键
|
||||
*/
|
||||
@GetMapping("/getByDefId/{definitionId}")
|
||||
public R<WfFormDefinitionVo> getByDefId(@NotBlank(message = "流程定义ID不能为空")
|
||||
@PathVariable String definitionId) {
|
||||
return R.ok(wfFormDefinitionService.getByDefId(definitionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增表单配置
|
||||
*/
|
||||
@Log(title = "表单配置", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/saveOrUpdate")
|
||||
public R<Void> saveOrUpdate(@Validated(AddGroup.class) @RequestBody WfFormDefinitionBo bo) {
|
||||
return toAjax(wfFormDefinitionService.saveOrUpdate(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除表单配置
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@Log(title = "表单配置", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(wfFormDefinitionService.deleteByIds(List.of(ids)));
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package org.dromara.workflow.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 表单配置对象 wf_form_definition
|
||||
*
|
||||
* @author gssong
|
||||
* @date 2024-03-18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("wf_form_definition")
|
||||
public class WfFormDefinition extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 路由地址
|
||||
*/
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 流程定义ID
|
||||
*/
|
||||
private String definitionId;
|
||||
|
||||
/**
|
||||
* 流程KEY
|
||||
*/
|
||||
private String processKey;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package org.dromara.workflow.domain.bo;
|
||||
|
||||
import org.dromara.workflow.domain.WfFormDefinition;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 表单配置业务对象 wf_form_definition
|
||||
*
|
||||
* @author gssong
|
||||
* @date 2024-03-18
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = WfFormDefinition.class, reverseConvertGenerate = false)
|
||||
public class WfFormDefinitionBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 路由地址
|
||||
*/
|
||||
@NotBlank(message = "路由地址不能为空", groups = {AddGroup.class})
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 流程定义ID
|
||||
*/
|
||||
@NotBlank(message = "流程定义ID不能为空", groups = {AddGroup.class})
|
||||
private String definitionId;
|
||||
|
||||
/**
|
||||
* 流程KEY
|
||||
*/
|
||||
@NotBlank(message = "流程KEY不能为空", groups = {AddGroup.class})
|
||||
private String processKey;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -62,4 +62,9 @@ public class ProcessDefinitionVo implements Serializable {
|
||||
*/
|
||||
private Date deploymentTime;
|
||||
|
||||
/**
|
||||
* 表单配置
|
||||
*/
|
||||
private WfFormDefinitionVo wfFormDefinitionVo;
|
||||
|
||||
}
|
||||
|
@ -150,4 +150,14 @@ public class TaskVo implements Serializable {
|
||||
* 是否会签
|
||||
*/
|
||||
private Boolean multiInstance;
|
||||
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private String businessKey;
|
||||
|
||||
/**
|
||||
* 表单配置
|
||||
*/
|
||||
private WfFormDefinitionVo wfFormDefinitionVo;
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
package org.dromara.workflow.domain.vo;
|
||||
|
||||
import org.dromara.workflow.domain.WfFormDefinition;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 表单配置视图对象 wf_form_definition
|
||||
*
|
||||
* @author gssong
|
||||
* @date 2024-03-18
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = WfFormDefinition.class)
|
||||
public class WfFormDefinitionVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 路由地址
|
||||
*/
|
||||
@ExcelProperty(value = "路由地址")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 流程定义ID
|
||||
*/
|
||||
@ExcelProperty(value = "流程定义ID")
|
||||
private String definitionId;
|
||||
|
||||
/**
|
||||
* 流程KEY
|
||||
*/
|
||||
@ExcelProperty(value = "流程KEY")
|
||||
private String processKey;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.workflow.mapper;
|
||||
|
||||
import org.dromara.workflow.domain.WfFormDefinition;
|
||||
import org.dromara.workflow.domain.vo.WfFormDefinitionVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 表单配置Mapper接口
|
||||
*
|
||||
* @author gssong
|
||||
* @date 2024-03-18
|
||||
*/
|
||||
public interface WfFormDefinitionMapper extends BaseMapperPlus<WfFormDefinition, WfFormDefinitionVo> {
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package org.dromara.workflow.service;
|
||||
|
||||
import org.dromara.workflow.domain.vo.WfFormDefinitionVo;
|
||||
import org.dromara.workflow.domain.bo.WfFormDefinitionBo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表单配置Service接口
|
||||
*
|
||||
* @author gssong
|
||||
* @date 2024-03-18
|
||||
*/
|
||||
public interface IWfFormDefinitionService {
|
||||
|
||||
/**
|
||||
* 查询表单配置
|
||||
*
|
||||
* @param definitionId 流程定义id
|
||||
* @return 结果
|
||||
*/
|
||||
WfFormDefinitionVo getByDefId(String definitionId);
|
||||
|
||||
/**
|
||||
* 查询表单配置列表
|
||||
*
|
||||
* @param definitionIds 流程定义id
|
||||
* @return 结果
|
||||
*/
|
||||
List<WfFormDefinitionVo> queryList(List<String> definitionIds);
|
||||
|
||||
|
||||
/**
|
||||
* 新增表单配置
|
||||
*
|
||||
* @param bo 参数
|
||||
* @return 结果
|
||||
*/
|
||||
Boolean saveOrUpdate(WfFormDefinitionBo bo);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param ids id
|
||||
* @return 结果
|
||||
*/
|
||||
Boolean deleteByIds(Collection<Long> ids);
|
||||
}
|
@ -20,8 +20,10 @@ import org.dromara.workflow.common.constant.FlowConstant;
|
||||
import org.dromara.workflow.domain.WfCategory;
|
||||
import org.dromara.workflow.domain.bo.ProcessDefinitionBo;
|
||||
import org.dromara.workflow.domain.vo.ProcessDefinitionVo;
|
||||
import org.dromara.workflow.domain.vo.WfFormDefinitionVo;
|
||||
import org.dromara.workflow.service.IActProcessDefinitionService;
|
||||
import org.dromara.workflow.service.IWfCategoryService;
|
||||
import org.dromara.workflow.service.IWfFormDefinitionService;
|
||||
import org.dromara.workflow.utils.QueryUtils;
|
||||
import org.flowable.engine.ProcessMigrationService;
|
||||
import org.flowable.engine.RepositoryService;
|
||||
@ -37,7 +39,6 @@ import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
@ -53,6 +54,7 @@ public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionSer
|
||||
private final RepositoryService repositoryService;
|
||||
private final ProcessMigrationService processMigrationService;
|
||||
private final IWfCategoryService wfCategoryService;
|
||||
private final IWfFormDefinitionService iWfFormDefinitionService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
@ -81,6 +83,9 @@ public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionSer
|
||||
List<String> deploymentIds = StreamUtils.toList(definitionList, ProcessDefinition::getDeploymentId);
|
||||
deploymentList = QueryUtils.deploymentQuery(deploymentIds).list();
|
||||
}
|
||||
if (CollUtil.isNotEmpty(definitionList)) {
|
||||
List<String> ids = StreamUtils.toList(definitionList, ProcessDefinition::getId);
|
||||
List<WfFormDefinitionVo> wfFormDefinitionVos = iWfFormDefinitionService.queryList(ids);
|
||||
for (ProcessDefinition processDefinition : definitionList) {
|
||||
ProcessDefinitionVo processDefinitionVo = BeanUtil.toBean(processDefinition, ProcessDefinitionVo.class);
|
||||
if (CollUtil.isNotEmpty(deploymentList)) {
|
||||
@ -89,8 +94,12 @@ public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionSer
|
||||
processDefinitionVo.setDeploymentTime(e.getDeploymentTime());
|
||||
});
|
||||
}
|
||||
if (CollUtil.isNotEmpty(wfFormDefinitionVos)) {
|
||||
wfFormDefinitionVos.stream().filter(e -> e.getDefinitionId().equals(processDefinition.getId())).findFirst().ifPresent(processDefinitionVo::setWfFormDefinitionVo);
|
||||
}
|
||||
processDefinitionVoList.add(processDefinitionVo);
|
||||
}
|
||||
}
|
||||
// 总记录数
|
||||
long total = query.count();
|
||||
|
||||
@ -109,9 +118,12 @@ public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionSer
|
||||
List<ProcessDefinition> definitionList = query.processDefinitionKey(key).list();
|
||||
List<Deployment> deploymentList = null;
|
||||
if (CollUtil.isNotEmpty(definitionList)) {
|
||||
List<String> deploymentIds = definitionList.stream().map(ProcessDefinition::getDeploymentId).collect(Collectors.toList());
|
||||
List<String> deploymentIds = StreamUtils.toList(definitionList, ProcessDefinition::getDeploymentId);
|
||||
deploymentList = QueryUtils.deploymentQuery(deploymentIds).list();
|
||||
}
|
||||
if (CollUtil.isNotEmpty(definitionList)) {
|
||||
List<String> ids = StreamUtils.toList(definitionList, ProcessDefinition::getId);
|
||||
List<WfFormDefinitionVo> wfFormDefinitionVos = iWfFormDefinitionService.queryList(ids);
|
||||
for (ProcessDefinition processDefinition : definitionList) {
|
||||
ProcessDefinitionVo processDefinitionVo = BeanUtil.toBean(processDefinition, ProcessDefinitionVo.class);
|
||||
if (CollUtil.isNotEmpty(deploymentList)) {
|
||||
@ -119,9 +131,13 @@ public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionSer
|
||||
deploymentList.stream().filter(e -> e.getId().equals(processDefinition.getDeploymentId())).findFirst().ifPresent(e -> {
|
||||
processDefinitionVo.setDeploymentTime(e.getDeploymentTime());
|
||||
});
|
||||
if (CollUtil.isNotEmpty(wfFormDefinitionVos)) {
|
||||
wfFormDefinitionVos.stream().filter(e -> e.getDefinitionId().equals(processDefinition.getId())).findFirst().ifPresent(processDefinitionVo::setWfFormDefinitionVo);
|
||||
}
|
||||
}
|
||||
processDefinitionVoList.add(processDefinitionVo);
|
||||
}
|
||||
}
|
||||
return CollectionUtil.reverse(processDefinitionVoList);
|
||||
}
|
||||
|
||||
|
@ -264,11 +264,15 @@ public class ActTaskServiceImpl implements IActTaskService {
|
||||
Page<TaskVo> page = actTaskMapper.getTaskWaitByPage(pageQuery.build(), queryWrapper);
|
||||
|
||||
List<TaskVo> taskList = page.getRecords();
|
||||
if (CollUtil.isNotEmpty(taskList)) {
|
||||
for (TaskVo task : taskList) {
|
||||
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
||||
task.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId()));
|
||||
task.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null);
|
||||
}
|
||||
List<String> processDefinitionIds = StreamUtils.toList(taskList, TaskVo::getProcessDefinitionId);
|
||||
WorkflowUtils.setWfFormDefinitionVo(taskList, processDefinitionIds, PROCESS_DEFINITION_ID);
|
||||
}
|
||||
return new TableDataInfo<>(taskList, page.getTotal());
|
||||
}
|
||||
|
||||
@ -345,9 +349,13 @@ public class ActTaskServiceImpl implements IActTaskService {
|
||||
Page<TaskVo> page = actTaskMapper.getTaskFinishByPage(pageQuery.build(), queryWrapper);
|
||||
|
||||
List<TaskVo> taskList = page.getRecords();
|
||||
if (CollUtil.isNotEmpty(taskList)) {
|
||||
for (TaskVo task : taskList) {
|
||||
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
||||
}
|
||||
List<String> processDefinitionIds = StreamUtils.toList(taskList, TaskVo::getProcessDefinitionId);
|
||||
WorkflowUtils.setWfFormDefinitionVo(taskList, processDefinitionIds, PROCESS_DEFINITION_ID);
|
||||
}
|
||||
return new TableDataInfo<>(taskList, page.getTotal());
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,9 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
||||
*/
|
||||
@Override
|
||||
public TestLeaveVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
TestLeaveVo testLeaveVo = baseMapper.selectVoById(id);
|
||||
WorkflowUtils.setProcessInstanceVo(testLeaveVo,String.valueOf(id));
|
||||
return testLeaveVo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,66 @@
|
||||
package org.dromara.workflow.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.workflow.domain.bo.WfFormDefinitionBo;
|
||||
import org.dromara.workflow.domain.vo.WfFormDefinitionVo;
|
||||
import org.dromara.workflow.domain.WfFormDefinition;
|
||||
import org.dromara.workflow.mapper.WfFormDefinitionMapper;
|
||||
import org.dromara.workflow.service.IWfFormDefinitionService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 表单配置Service业务层处理
|
||||
*
|
||||
* @author gssong
|
||||
* @date 2024-03-18
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WfFormDefinitionServiceImpl implements IWfFormDefinitionService {
|
||||
|
||||
private final WfFormDefinitionMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询表单配置
|
||||
*/
|
||||
@Override
|
||||
public WfFormDefinitionVo getByDefId(String definitionId) {
|
||||
return baseMapper.selectVoOne(new LambdaQueryWrapper<WfFormDefinition>().eq(WfFormDefinition::getDefinitionId, definitionId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询表单配置列表
|
||||
*/
|
||||
@Override
|
||||
public List<WfFormDefinitionVo> queryList(List<String> definitionIds) {
|
||||
return baseMapper.selectVoList(new LambdaQueryWrapper<WfFormDefinition>().in(WfFormDefinition::getDefinitionId, definitionIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增表单配置
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean saveOrUpdate(WfFormDefinitionBo bo) {
|
||||
WfFormDefinition add = MapstructUtils.convert(bo, WfFormDefinition.class);
|
||||
boolean flag = baseMapper.insertOrUpdate(add);
|
||||
if (baseMapper.insertOrUpdate(add)) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除表单配置
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteByIds(Collection<Long> ids) {
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -26,9 +26,11 @@ import org.dromara.workflow.domain.ActHiTaskinst;
|
||||
import org.dromara.workflow.domain.vo.MultiInstanceVo;
|
||||
import org.dromara.workflow.domain.vo.ParticipantVo;
|
||||
import org.dromara.workflow.domain.vo.ProcessInstanceVo;
|
||||
import org.dromara.workflow.domain.vo.WfFormDefinitionVo;
|
||||
import org.dromara.workflow.flowable.cmd.UpdateHiTaskInstCmd;
|
||||
import org.dromara.workflow.mapper.ActHiTaskinstMapper;
|
||||
import org.dromara.workflow.service.IActHiProcinstService;
|
||||
import org.dromara.workflow.service.IWfFormDefinitionService;
|
||||
import org.dromara.workflow.service.IWorkflowUserService;
|
||||
import org.flowable.bpmn.model.BpmnModel;
|
||||
import org.flowable.bpmn.model.FlowNode;
|
||||
@ -45,6 +47,7 @@ import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
||||
import java.util.*;
|
||||
|
||||
import static org.dromara.workflow.common.constant.FlowConstant.PROCESS_INSTANCE_VO;
|
||||
import static org.dromara.workflow.common.constant.FlowConstant.WF_FORM_DEFINITION_VO;
|
||||
|
||||
/**
|
||||
* 工作流工具
|
||||
@ -58,6 +61,7 @@ public class WorkflowUtils {
|
||||
private static final IWorkflowUserService WORKFLOW_USER_SERVICE = SpringUtils.getBean(IWorkflowUserService.class);
|
||||
private static final IActHiProcinstService ACT_HI_PROCINST_SERVICE = SpringUtils.getBean(IActHiProcinstService.class);
|
||||
private static final ActHiTaskinstMapper ACT_HI_TASKINST_MAPPER = SpringUtils.getBean(ActHiTaskinstMapper.class);
|
||||
private static final IWfFormDefinitionService I_WF_FORM_DEFINITION_SERVICE = SpringUtils.getBean(IWfFormDefinitionService.class);
|
||||
|
||||
/**
|
||||
* 创建一个新任务
|
||||
@ -241,7 +245,7 @@ public class WorkflowUtils {
|
||||
* @param businessKey 业务id
|
||||
*/
|
||||
public static void setProcessInstanceVo(Object obj, String businessKey) {
|
||||
if (StringUtils.isBlank(businessKey)) {
|
||||
if (StringUtils.isBlank(businessKey) || obj == null) {
|
||||
return;
|
||||
}
|
||||
ActHiProcinst actHiProcinst = ACT_HI_PROCINST_SERVICE.selectByBusinessKey(businessKey);
|
||||
@ -264,7 +268,7 @@ public class WorkflowUtils {
|
||||
* @param fieldName 主键属性名称
|
||||
*/
|
||||
public static void setProcessInstanceListVo(Object obj, List<String> idList, String fieldName) {
|
||||
if (CollUtil.isEmpty(idList)) {
|
||||
if (CollUtil.isEmpty(idList) || obj == null) {
|
||||
return;
|
||||
}
|
||||
List<ActHiProcinst> actHiProcinstList = ACT_HI_PROCINST_SERVICE.selectByBusinessKeyIn(idList);
|
||||
@ -293,6 +297,31 @@ public class WorkflowUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置流程表单配置
|
||||
*
|
||||
* @param obj 业务对象
|
||||
* @param idList 流程定义id
|
||||
* @param fieldName 流程定义ID属性名称
|
||||
*/
|
||||
public static void setWfFormDefinitionVo(Object obj, List<String> idList, String fieldName) {
|
||||
if (CollUtil.isEmpty(idList) || obj == null) {
|
||||
return;
|
||||
}
|
||||
List<WfFormDefinitionVo> wfFormDefinitionVoList = I_WF_FORM_DEFINITION_SERVICE.queryList(idList);
|
||||
if (obj instanceof Collection<?> collection) {
|
||||
for (Object o : collection) {
|
||||
String fieldValue = ReflectUtils.invokeGetter(o, fieldName).toString();
|
||||
if (!CollUtil.isEmpty(wfFormDefinitionVoList)) {
|
||||
wfFormDefinitionVoList.stream().filter(e -> e.getDefinitionId().equals(fieldValue)).findFirst().ifPresent(e -> {
|
||||
ReflectUtils.invokeSetter(o, WF_FORM_DEFINITION_VO, BeanUtil.toBean(e, WfFormDefinitionVo.class));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
|
@ -27,12 +27,14 @@
|
||||
<result property="businessStatus" column="BUSINESS_STATUS_"/>
|
||||
<result property="processDefinitionName" column="processDefinitionName"/>
|
||||
<result property="processDefinitionKey" column="processDefinitionName"/>
|
||||
<result property="businessKey" column="BUSINESS_KEY_"/>
|
||||
|
||||
</resultMap>
|
||||
<select id="getTaskWaitByPage" resultMap="TaskVoResult">
|
||||
select *
|
||||
from (SELECT RES.*,
|
||||
AHP.BUSINESS_STATUS_,
|
||||
AHP.BUSINESS_KEY_,
|
||||
ARP.NAME_ AS processDefinitionName,
|
||||
ARP.KEY_ AS processDefinitionKey
|
||||
FROM ACT_RU_TASK RES
|
||||
@ -46,6 +48,7 @@
|
||||
select *
|
||||
from (SELECT HTI.*,
|
||||
AHP.BUSINESS_STATUS_,
|
||||
AHP.BUSINESS_KEY_,
|
||||
ARP.NAME_ AS processDefinitionName,
|
||||
ARP.KEY_ AS processDefinitionKey
|
||||
FROM ACT_HI_TASKINST HTI
|
||||
@ -59,6 +62,7 @@
|
||||
select *
|
||||
from (SELECT AHT.*,
|
||||
AHP.BUSINESS_STATUS_,
|
||||
AHP.BUSINESS_KEY_,
|
||||
ARP.NAME_ as processDefinitionName,
|
||||
ARP.KEY_ as processDefinitionKey
|
||||
FROM ACT_HI_TASKINST AHT
|
||||
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.workflow.mapper.WfFormDefinitionMapper">
|
||||
|
||||
</mapper>
|
@ -78,6 +78,26 @@ create table wf_task_back_node
|
||||
)
|
||||
comment '节点审批记录';
|
||||
|
||||
create table wf_form_definition
|
||||
(
|
||||
id bigint not null comment '主键'
|
||||
primary key,
|
||||
path varchar(200) default '' not null comment '路由地址',
|
||||
definition_id varchar(255) not null comment '流程定义ID',
|
||||
process_key varchar(255) not null comment '流程KEY',
|
||||
create_dept bigint null comment '创建部门',
|
||||
create_by bigint null comment '创建者',
|
||||
create_time datetime null comment '创建时间',
|
||||
update_by bigint null comment '更新者',
|
||||
update_time datetime null comment '更新时间',
|
||||
remark varchar(500) default '' null comment '备注',
|
||||
tenant_id varchar(20) default '000000' null comment '租户编号',
|
||||
constraint uni_definition_id
|
||||
unique (definition_id)
|
||||
)
|
||||
comment '表单配置';
|
||||
|
||||
|
||||
|
||||
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11638, '请假申请', 5, 1, 'leave', 'workflow/leave/index', 1, 0, 'C', '0', '0', 'demo:leave:list', '#', 103, 1, sysdate(), NULL, NULL, '请假申请菜单');
|
||||
INSERT INTO sys_menu(menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) VALUES (11639, '请假申请查询', 11638, 1, '#', '', 1, 0, 'F', '0', '0', 'demo:leave:query', '#', 103, 1, sysdate(), NULL, NULL, '');
|
||||
|
Loading…
x
Reference in New Issue
Block a user