update 优化表单绑定逻辑,移除流程定义配置表单
This commit is contained in:
parent
a73c65eae9
commit
1da98c8a82
@ -80,6 +80,11 @@ public interface FlowConstant {
|
|||||||
*/
|
*/
|
||||||
String WF_DEFINITION_CONFIG_VO = "wfDefinitionConfigVo";
|
String WF_DEFINITION_CONFIG_VO = "wfDefinitionConfigVo";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点配置
|
||||||
|
*/
|
||||||
|
String WF_NODE_CONFIG_VO = "wfNodeConfigVo";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程发起人
|
* 流程发起人
|
||||||
*/
|
*/
|
||||||
@ -119,4 +124,14 @@ public interface FlowConstant {
|
|||||||
* 会签
|
* 会签
|
||||||
*/
|
*/
|
||||||
String MULTI_INSTANCE = "multiInstance";
|
String MULTI_INSTANCE = "multiInstance";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是
|
||||||
|
*/
|
||||||
|
String TRUE = "0";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 否
|
||||||
|
*/
|
||||||
|
String FALSE = "1";
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ public class ActModelController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 导出模型zip压缩包
|
* 导出模型zip压缩包
|
||||||
*
|
*
|
||||||
* @param modelIds 模型id
|
* @param modelIds 模型id
|
||||||
* @param response 相应
|
* @param response 相应
|
||||||
*/
|
*/
|
||||||
@GetMapping("/export/zip/{modelIds}")
|
@GetMapping("/export/zip/{modelIds}")
|
||||||
@ -134,4 +134,14 @@ public class ActModelController extends BaseController {
|
|||||||
HttpServletResponse response) {
|
HttpServletResponse response) {
|
||||||
actModelService.exportZip(modelIds, response);
|
actModelService.exportZip(modelIds, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制模型
|
||||||
|
*
|
||||||
|
* @param modelBo 模型数据
|
||||||
|
*/
|
||||||
|
@PostMapping("/copyModel")
|
||||||
|
public R<Void> copyModel(@RequestBody ModelBo modelBo) {
|
||||||
|
return toAjax(actModelService.copyModel(modelBo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,5 +52,10 @@ public class WfNodeConfig extends TenantEntity {
|
|||||||
*/
|
*/
|
||||||
private String definitionId;
|
private String definitionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为申请人节点 (0是 1否)
|
||||||
|
*/
|
||||||
|
private String applyUserTask;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class WfNodeConfigBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,20 +39,25 @@ public class WfNodeConfigBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 节点名称
|
* 节点名称
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "节点名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotBlank(message = "节点名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
private String nodeName;
|
private String nodeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 节点id
|
* 节点id
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "节点id不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotBlank(message = "节点id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
private String nodeId;
|
private String nodeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程定义id
|
* 流程定义id
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "流程定义id不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotBlank(message = "流程定义id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
private String definitionId;
|
private String definitionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为申请人节点 (0是 1否)
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "是否为申请人节点不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
|
private String applyUserTask;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public class ProcessInstanceVo implements Serializable {
|
|||||||
private List<TaskVo> taskVoList;
|
private List<TaskVo> taskVoList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程定义配置
|
* 节点配置
|
||||||
*/
|
*/
|
||||||
private WfDefinitionConfigVo wfDefinitionConfigVo;
|
private WfNodeConfigVo wfNodeConfigVo;
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,12 @@ public class WfNodeConfigVo implements Serializable {
|
|||||||
@ExcelProperty(value = "流程定义id")
|
@ExcelProperty(value = "流程定义id")
|
||||||
private String definitionId;
|
private String definitionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否为申请人节点 (0是 1否)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "是否为申请人节点 (0是 1否)")
|
||||||
|
private String applyUserTask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单管理
|
* 表单管理
|
||||||
*/
|
*/
|
||||||
|
@ -68,8 +68,16 @@ public interface IActModelService {
|
|||||||
/**
|
/**
|
||||||
* 导出模型zip压缩包
|
* 导出模型zip压缩包
|
||||||
*
|
*
|
||||||
* @param modelIds 模型id
|
* @param modelIds 模型id
|
||||||
* @param response 相应
|
* @param response 响应
|
||||||
*/
|
*/
|
||||||
void exportZip(List<String> modelIds, HttpServletResponse response);
|
void exportZip(List<String> modelIds, HttpServletResponse response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制模型
|
||||||
|
*
|
||||||
|
* @param modelBo 模型数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
boolean copyModel(ModelBo modelBo);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.ArrayUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.core.util.ZipUtil;
|
import cn.hutool.core.util.ZipUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.excel.util.StringUtils;
|
import com.alibaba.excel.util.StringUtils;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@ -21,15 +22,14 @@ import org.dromara.common.tenant.helper.TenantHelper;
|
|||||||
import org.dromara.workflow.common.constant.FlowConstant;
|
import org.dromara.workflow.common.constant.FlowConstant;
|
||||||
import org.dromara.workflow.domain.WfNodeConfig;
|
import org.dromara.workflow.domain.WfNodeConfig;
|
||||||
import org.dromara.workflow.domain.bo.ModelBo;
|
import org.dromara.workflow.domain.bo.ModelBo;
|
||||||
import org.dromara.workflow.domain.bo.WfDefinitionConfigBo;
|
|
||||||
import org.dromara.workflow.domain.vo.ModelVo;
|
import org.dromara.workflow.domain.vo.ModelVo;
|
||||||
import org.dromara.workflow.domain.vo.WfDefinitionConfigVo;
|
|
||||||
import org.dromara.workflow.service.IActModelService;
|
import org.dromara.workflow.service.IActModelService;
|
||||||
import org.dromara.workflow.service.IWfDefinitionConfigService;
|
|
||||||
import org.dromara.workflow.service.IWfNodeConfigService;
|
import org.dromara.workflow.service.IWfNodeConfigService;
|
||||||
import org.dromara.workflow.utils.ModelUtils;
|
import org.dromara.workflow.utils.ModelUtils;
|
||||||
import org.dromara.workflow.utils.QueryUtils;
|
import org.dromara.workflow.utils.QueryUtils;
|
||||||
|
import org.flowable.bpmn.converter.BpmnXMLConverter;
|
||||||
import org.flowable.bpmn.model.BpmnModel;
|
import org.flowable.bpmn.model.BpmnModel;
|
||||||
|
import org.flowable.bpmn.model.Process;
|
||||||
import org.flowable.bpmn.model.UserTask;
|
import org.flowable.bpmn.model.UserTask;
|
||||||
import org.flowable.engine.RepositoryService;
|
import org.flowable.engine.RepositoryService;
|
||||||
import org.flowable.engine.repository.*;
|
import org.flowable.engine.repository.*;
|
||||||
@ -59,7 +59,6 @@ import java.util.zip.ZipOutputStream;
|
|||||||
public class ActModelServiceImpl implements IActModelService {
|
public class ActModelServiceImpl implements IActModelService {
|
||||||
|
|
||||||
private final RepositoryService repositoryService;
|
private final RepositoryService repositoryService;
|
||||||
private final IWfDefinitionConfigService iWfDefinitionConfigService;
|
|
||||||
private final IWfNodeConfigService iWfNodeConfigService;
|
private final IWfNodeConfigService iWfNodeConfigService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -261,7 +260,6 @@ public class ActModelServiceImpl implements IActModelService {
|
|||||||
}
|
}
|
||||||
// 查询模型的基本信息
|
// 查询模型的基本信息
|
||||||
Model model = repositoryService.getModel(id);
|
Model model = repositoryService.getModel(id);
|
||||||
ProcessDefinition processDefinition = QueryUtils.definitionQuery().processDefinitionKey(model.getKey()).latestVersion().singleResult();
|
|
||||||
// xml资源的名称 ,对应act_ge_bytearray表中的name_字段
|
// xml资源的名称 ,对应act_ge_bytearray表中的name_字段
|
||||||
String processName = model.getName() + ".bpmn20.xml";
|
String processName = model.getName() + ".bpmn20.xml";
|
||||||
// 调用部署相关的api方法进行部署流程定义
|
// 调用部署相关的api方法进行部署流程定义
|
||||||
@ -284,20 +282,9 @@ public class ActModelServiceImpl implements IActModelService {
|
|||||||
// 更新分类
|
// 更新分类
|
||||||
ProcessDefinition definition = QueryUtils.definitionQuery().deploymentId(deployment.getId()).singleResult();
|
ProcessDefinition definition = QueryUtils.definitionQuery().deploymentId(deployment.getId()).singleResult();
|
||||||
repositoryService.setProcessDefinitionCategory(definition.getId(), model.getCategory());
|
repositoryService.setProcessDefinitionCategory(definition.getId(), model.getCategory());
|
||||||
//更新流程定义表单
|
|
||||||
if (processDefinition != null) {
|
|
||||||
WfDefinitionConfigVo definitionVo = iWfDefinitionConfigService.getByDefId(processDefinition.getId());
|
|
||||||
if (definitionVo != null) {
|
|
||||||
WfDefinitionConfigBo wfFormDefinition = new WfDefinitionConfigBo();
|
|
||||||
wfFormDefinition.setDefinitionId(definition.getId());
|
|
||||||
wfFormDefinition.setProcessKey(definition.getKey());
|
|
||||||
wfFormDefinition.setFormId(ObjectUtil.isNotNull(definitionVo.getFormId()) ? definitionVo.getFormId() : null);
|
|
||||||
wfFormDefinition.setRemark(definitionVo.getRemark());
|
|
||||||
iWfDefinitionConfigService.saveOrUpdate(wfFormDefinition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//更新流程节点配置表单
|
//更新流程节点配置表单
|
||||||
List<UserTask> userTasks = ModelUtils.getuserTaskFlowElements(definition.getId());
|
List<UserTask> userTasks = ModelUtils.getUserTaskFlowElements(definition.getId());
|
||||||
|
UserTask applyUserTask = ModelUtils.getApplyUserTask(definition.getId());
|
||||||
List<WfNodeConfig> wfNodeConfigList = new ArrayList<>();
|
List<WfNodeConfig> wfNodeConfigList = new ArrayList<>();
|
||||||
for (UserTask userTask : userTasks) {
|
for (UserTask userTask : userTasks) {
|
||||||
if (StringUtils.isNotBlank(userTask.getFormKey()) && userTask.getFormKey().contains(StrUtil.COLON)) {
|
if (StringUtils.isNotBlank(userTask.getFormKey()) && userTask.getFormKey().contains(StrUtil.COLON)) {
|
||||||
@ -308,6 +295,7 @@ public class ActModelServiceImpl implements IActModelService {
|
|||||||
String[] split = userTask.getFormKey().split(StrUtil.COLON);
|
String[] split = userTask.getFormKey().split(StrUtil.COLON);
|
||||||
wfNodeConfig.setFormType(split[0]);
|
wfNodeConfig.setFormType(split[0]);
|
||||||
wfNodeConfig.setFormId(Long.valueOf(split[1]));
|
wfNodeConfig.setFormId(Long.valueOf(split[1]));
|
||||||
|
wfNodeConfig.setApplyUserTask(applyUserTask.getId().equals(userTask.getId()) ? FlowConstant.TRUE : FlowConstant.FALSE);
|
||||||
wfNodeConfigList.add(wfNodeConfig);
|
wfNodeConfigList.add(wfNodeConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,4 +362,52 @@ public class ActModelServiceImpl implements IActModelService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制模型
|
||||||
|
*
|
||||||
|
* @param modelBo 模型数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean copyModel(ModelBo modelBo) {
|
||||||
|
try {
|
||||||
|
String key = modelBo.getKey();
|
||||||
|
if (StringUtils.isNotBlank(key)) {
|
||||||
|
// 查询模型
|
||||||
|
Model model = repositoryService.createModelQuery().modelId(modelBo.getId()).singleResult();
|
||||||
|
if (ObjectUtil.isNotNull(model)) {
|
||||||
|
byte[] modelEditorSource = repositoryService.getModelEditorSource(model.getId());
|
||||||
|
List<Model> list = QueryUtils.modelQuery().modelKey(key).list();
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
throw new ServiceException("模型KEY已存在!");
|
||||||
|
}
|
||||||
|
// 校验key命名规范
|
||||||
|
if (!Validator.isMatchRegex(FlowConstant.MODEL_KEY_PATTERN, key)) {
|
||||||
|
throw new ServiceException("模型标识KEY只能字符或者下划线开头!");
|
||||||
|
}
|
||||||
|
// 复制模型数据
|
||||||
|
Model newModel = repositoryService.newModel();
|
||||||
|
newModel.setKey(modelBo.getKey());
|
||||||
|
newModel.setName(modelBo.getName());
|
||||||
|
newModel.setCategory(modelBo.getCategoryCode());
|
||||||
|
newModel.setVersion(1);
|
||||||
|
newModel.setMetaInfo(modelBo.getDescription());
|
||||||
|
newModel.setTenantId(TenantHelper.getTenantId());
|
||||||
|
String xml = StrUtil.utf8Str(modelEditorSource);
|
||||||
|
BpmnModel bpmnModel = ModelUtils.xmlToBpmnModel(xml);
|
||||||
|
Process mainProcess = bpmnModel.getMainProcess();
|
||||||
|
mainProcess.setId(modelBo.getKey());
|
||||||
|
mainProcess.setName(modelBo.getName());
|
||||||
|
byte[] xmlBytes = new BpmnXMLConverter().convertToXML(bpmnModel);
|
||||||
|
repositoryService.saveModel(newModel);
|
||||||
|
repositoryService.addModelEditorSource(newModel.getId(), xmlBytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException(e.getMessage());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ import org.dromara.workflow.common.constant.FlowConstant;
|
|||||||
import org.dromara.workflow.domain.WfCategory;
|
import org.dromara.workflow.domain.WfCategory;
|
||||||
import org.dromara.workflow.domain.WfNodeConfig;
|
import org.dromara.workflow.domain.WfNodeConfig;
|
||||||
import org.dromara.workflow.domain.bo.ProcessDefinitionBo;
|
import org.dromara.workflow.domain.bo.ProcessDefinitionBo;
|
||||||
import org.dromara.workflow.domain.bo.WfDefinitionConfigBo;
|
|
||||||
import org.dromara.workflow.domain.vo.ProcessDefinitionVo;
|
import org.dromara.workflow.domain.vo.ProcessDefinitionVo;
|
||||||
import org.dromara.workflow.domain.vo.WfDefinitionConfigVo;
|
import org.dromara.workflow.domain.vo.WfDefinitionConfigVo;
|
||||||
import org.dromara.workflow.service.IActProcessDefinitionService;
|
import org.dromara.workflow.service.IActProcessDefinitionService;
|
||||||
@ -323,14 +322,13 @@ public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionSer
|
|||||||
String processName = splitFilename[0];
|
String processName = splitFilename[0];
|
||||||
//流程key
|
//流程key
|
||||||
String processKey = splitFilename[1];
|
String processKey = splitFilename[1];
|
||||||
ProcessDefinition oldProcessDefinition = QueryUtils.definitionQuery().processDefinitionKey(processKey).latestVersion().singleResult();
|
|
||||||
DeploymentBuilder builder = repositoryService.createDeployment();
|
DeploymentBuilder builder = repositoryService.createDeployment();
|
||||||
Deployment deployment = builder.addInputStream(filename, zipInputStream)
|
Deployment deployment = builder.addInputStream(filename, zipInputStream)
|
||||||
.tenantId(TenantHelper.getTenantId())
|
.tenantId(TenantHelper.getTenantId())
|
||||||
.name(processName).key(processKey).category(categoryCode).deploy();
|
.name(processName).key(processKey).category(categoryCode).deploy();
|
||||||
ProcessDefinition definition = QueryUtils.definitionQuery().deploymentId(deployment.getId()).singleResult();
|
ProcessDefinition definition = QueryUtils.definitionQuery().deploymentId(deployment.getId()).singleResult();
|
||||||
repositoryService.setProcessDefinitionCategory(definition.getId(), categoryCode);
|
repositoryService.setProcessDefinitionCategory(definition.getId(), categoryCode);
|
||||||
setForm(oldProcessDefinition, definition);
|
setWfNodeConfig(definition);
|
||||||
zipInputStream.closeEntry();
|
zipInputStream.closeEntry();
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -353,7 +351,6 @@ public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionSer
|
|||||||
String processName = splitFilename[0];
|
String processName = splitFilename[0];
|
||||||
//流程key
|
//流程key
|
||||||
String processKey = splitFilename[1];
|
String processKey = splitFilename[1];
|
||||||
ProcessDefinition oldProcessDefinition = QueryUtils.definitionQuery().processDefinitionKey(processKey).latestVersion().singleResult();
|
|
||||||
|
|
||||||
DeploymentBuilder builder = repositoryService.createDeployment();
|
DeploymentBuilder builder = repositoryService.createDeployment();
|
||||||
Deployment deployment = builder.addInputStream(originalFilename, inputStream)
|
Deployment deployment = builder.addInputStream(originalFilename, inputStream)
|
||||||
@ -362,7 +359,7 @@ public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionSer
|
|||||||
// 更新分类
|
// 更新分类
|
||||||
ProcessDefinition definition = QueryUtils.definitionQuery().deploymentId(deployment.getId()).singleResult();
|
ProcessDefinition definition = QueryUtils.definitionQuery().deploymentId(deployment.getId()).singleResult();
|
||||||
repositoryService.setProcessDefinitionCategory(definition.getId(), categoryCode);
|
repositoryService.setProcessDefinitionCategory(definition.getId(), categoryCode);
|
||||||
setForm(oldProcessDefinition, definition);
|
setWfNodeConfig(definition);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new ServiceException("文件类型上传错误!");
|
throw new ServiceException("文件类型上传错误!");
|
||||||
@ -374,24 +371,12 @@ public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionSer
|
|||||||
/**
|
/**
|
||||||
* 设置表单内容
|
* 设置表单内容
|
||||||
*
|
*
|
||||||
* @param oldProcessDefinition 部署前最新流程定义
|
* @param definition 部署后最新流程定义
|
||||||
* @param definition 部署后最新流程定义
|
|
||||||
*/
|
*/
|
||||||
private void setForm(ProcessDefinition oldProcessDefinition, ProcessDefinition definition) {
|
private void setWfNodeConfig(ProcessDefinition definition) {
|
||||||
//更新流程定义表单
|
|
||||||
if (oldProcessDefinition != null) {
|
|
||||||
WfDefinitionConfigVo definitionVo = iWfDefinitionConfigService.getByDefId(oldProcessDefinition.getId());
|
|
||||||
if (definitionVo != null) {
|
|
||||||
WfDefinitionConfigBo wfFormDefinition = new WfDefinitionConfigBo();
|
|
||||||
wfFormDefinition.setDefinitionId(definition.getId());
|
|
||||||
wfFormDefinition.setProcessKey(definition.getKey());
|
|
||||||
wfFormDefinition.setFormId(ObjectUtil.isNotNull(definitionVo.getFormId()) ? definitionVo.getFormId() : null);
|
|
||||||
wfFormDefinition.setRemark(definitionVo.getRemark());
|
|
||||||
iWfDefinitionConfigService.saveOrUpdate(wfFormDefinition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//更新流程节点配置表单
|
//更新流程节点配置表单
|
||||||
List<UserTask> userTasks = ModelUtils.getuserTaskFlowElements(definition.getId());
|
List<UserTask> userTasks = ModelUtils.getUserTaskFlowElements(definition.getId());
|
||||||
|
UserTask applyUserTask = ModelUtils.getApplyUserTask(definition.getId());
|
||||||
List<WfNodeConfig> wfNodeConfigList = new ArrayList<>();
|
List<WfNodeConfig> wfNodeConfigList = new ArrayList<>();
|
||||||
for (UserTask userTask : userTasks) {
|
for (UserTask userTask : userTasks) {
|
||||||
if (StringUtils.isNotBlank(userTask.getFormKey()) && userTask.getFormKey().contains(StrUtil.COLON)) {
|
if (StringUtils.isNotBlank(userTask.getFormKey()) && userTask.getFormKey().contains(StrUtil.COLON)) {
|
||||||
@ -402,6 +387,7 @@ public class ActProcessDefinitionServiceImpl implements IActProcessDefinitionSer
|
|||||||
String[] split = userTask.getFormKey().split(StrUtil.COLON);
|
String[] split = userTask.getFormKey().split(StrUtil.COLON);
|
||||||
wfNodeConfig.setFormType(split[0]);
|
wfNodeConfig.setFormType(split[0]);
|
||||||
wfNodeConfig.setFormId(Long.valueOf(split[1]));
|
wfNodeConfig.setFormId(Long.valueOf(split[1]));
|
||||||
|
wfNodeConfig.setApplyUserTask(applyUserTask.getId().equals(userTask.getId()) ? FlowConstant.TRUE : FlowConstant.FALSE);
|
||||||
wfNodeConfigList.add(wfNodeConfig);
|
wfNodeConfigList.add(wfNodeConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import org.dromara.workflow.flowable.strategy.FlowEventStrategy;
|
|||||||
import org.dromara.workflow.flowable.strategy.FlowProcessEventHandler;
|
import org.dromara.workflow.flowable.strategy.FlowProcessEventHandler;
|
||||||
import org.dromara.workflow.service.IActHiProcinstService;
|
import org.dromara.workflow.service.IActHiProcinstService;
|
||||||
import org.dromara.workflow.service.IActProcessInstanceService;
|
import org.dromara.workflow.service.IActProcessInstanceService;
|
||||||
|
import org.dromara.workflow.service.IWfNodeConfigService;
|
||||||
import org.dromara.workflow.service.IWfTaskBackNodeService;
|
import org.dromara.workflow.service.IWfTaskBackNodeService;
|
||||||
import org.dromara.workflow.utils.QueryUtils;
|
import org.dromara.workflow.utils.QueryUtils;
|
||||||
import org.dromara.workflow.utils.WorkflowUtils;
|
import org.dromara.workflow.utils.WorkflowUtils;
|
||||||
@ -58,8 +59,6 @@ import java.util.List;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.dromara.workflow.common.constant.FlowConstant.PROCESS_DEFINITION_ID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程实例 服务层实现
|
* 流程实例 服务层实现
|
||||||
*
|
*
|
||||||
@ -78,6 +77,7 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
|
|||||||
private final ManagementService managementService;
|
private final ManagementService managementService;
|
||||||
private final FlowEventStrategy flowEventStrategy;
|
private final FlowEventStrategy flowEventStrategy;
|
||||||
private final IWfTaskBackNodeService iWfTaskBackNodeService;
|
private final IWfTaskBackNodeService iWfTaskBackNodeService;
|
||||||
|
private final IWfNodeConfigService iWfNodeConfigService;
|
||||||
|
|
||||||
@Value("${flowable.activity-font-name}")
|
@Value("${flowable.activity-font-name}")
|
||||||
private String activityFontName;
|
private String activityFontName;
|
||||||
@ -122,7 +122,12 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
|
|||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
List<String> processDefinitionIds = StreamUtils.toList(list, ProcessInstanceVo::getProcessDefinitionId);
|
List<String> processDefinitionIds = StreamUtils.toList(list, ProcessInstanceVo::getProcessDefinitionId);
|
||||||
WorkflowUtils.setWfDefinitionConfigVo(list, processDefinitionIds, PROCESS_DEFINITION_ID);
|
List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds);
|
||||||
|
for (ProcessInstanceVo processInstanceVo : list) {
|
||||||
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(processInstanceVo.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(processInstanceVo::setWfNodeConfigVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
long count = query.count();
|
long count = query.count();
|
||||||
TableDataInfo<ProcessInstanceVo> build = TableDataInfo.build();
|
TableDataInfo<ProcessInstanceVo> build = TableDataInfo.build();
|
||||||
@ -164,7 +169,12 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
|
|||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
List<String> processDefinitionIds = StreamUtils.toList(list, ProcessInstanceVo::getProcessDefinitionId);
|
List<String> processDefinitionIds = StreamUtils.toList(list, ProcessInstanceVo::getProcessDefinitionId);
|
||||||
WorkflowUtils.setWfDefinitionConfigVo(list, processDefinitionIds, PROCESS_DEFINITION_ID);
|
List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds);
|
||||||
|
for (ProcessInstanceVo processInstanceVo : list) {
|
||||||
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(processInstanceVo.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(processInstanceVo::setWfNodeConfigVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
long count = query.count();
|
long count = query.count();
|
||||||
TableDataInfo<ProcessInstanceVo> build = TableDataInfo.build();
|
TableDataInfo<ProcessInstanceVo> build = TableDataInfo.build();
|
||||||
@ -669,7 +679,12 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
|
|||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
List<String> processDefinitionIds = StreamUtils.toList(list, ProcessInstanceVo::getProcessDefinitionId);
|
List<String> processDefinitionIds = StreamUtils.toList(list, ProcessInstanceVo::getProcessDefinitionId);
|
||||||
WorkflowUtils.setWfDefinitionConfigVo(list, processDefinitionIds, PROCESS_DEFINITION_ID);
|
List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds);
|
||||||
|
for (ProcessInstanceVo processInstanceVo : list) {
|
||||||
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(processInstanceVo.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(processInstanceVo::setWfNodeConfigVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
long count = query.count();
|
long count = query.count();
|
||||||
TableDataInfo<ProcessInstanceVo> build = TableDataInfo.build();
|
TableDataInfo<ProcessInstanceVo> build = TableDataInfo.build();
|
||||||
|
@ -282,10 +282,10 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
task.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId()));
|
task.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId()));
|
||||||
task.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null);
|
task.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null);
|
||||||
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WorkflowUtils.setWfDefinitionConfigVo(taskList, processDefinitionIds, PROCESS_DEFINITION_ID);
|
|
||||||
}
|
}
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
@ -347,11 +347,11 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
taskVo.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId()));
|
taskVo.setParticipantVo(WorkflowUtils.getCurrentTaskParticipant(task.getId()));
|
||||||
taskVo.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null);
|
taskVo.setMultiInstance(WorkflowUtils.isMultiInstance(task.getProcessDefinitionId(), task.getTaskDefinitionKey()) != null);
|
||||||
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey())).findFirst().ifPresent(taskVo::setWfNodeConfigVo);
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(taskVo::setWfNodeConfigVo);
|
||||||
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(taskVo::setWfNodeConfigVo);
|
||||||
}
|
}
|
||||||
list.add(taskVo);
|
list.add(taskVo);
|
||||||
}
|
}
|
||||||
WorkflowUtils.setWfDefinitionConfigVo(list, processDefinitionIds, PROCESS_DEFINITION_ID);
|
|
||||||
}
|
}
|
||||||
long count = query.count();
|
long count = query.count();
|
||||||
TableDataInfo<TaskVo> build = TableDataInfo.build();
|
TableDataInfo<TaskVo> build = TableDataInfo.build();
|
||||||
@ -382,10 +382,10 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
for (TaskVo task : taskList) {
|
for (TaskVo task : taskList) {
|
||||||
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
||||||
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WorkflowUtils.setWfDefinitionConfigVo(taskList, processDefinitionIds, PROCESS_DEFINITION_ID);
|
|
||||||
}
|
}
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
@ -418,11 +418,10 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
for (TaskVo task : taskList) {
|
for (TaskVo task : taskList) {
|
||||||
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
||||||
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WorkflowUtils.setWfDefinitionConfigVo(taskList, processDefinitionIds, PROCESS_DEFINITION_ID);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
@ -441,12 +440,16 @@ public class ActTaskServiceImpl implements IActTaskService {
|
|||||||
Page<TaskVo> page = actTaskMapper.getTaskFinishByPage(pageQuery.build(), queryWrapper);
|
Page<TaskVo> page = actTaskMapper.getTaskFinishByPage(pageQuery.build(), queryWrapper);
|
||||||
|
|
||||||
List<TaskVo> taskList = page.getRecords();
|
List<TaskVo> taskList = page.getRecords();
|
||||||
for (TaskVo task : taskList) {
|
|
||||||
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
|
||||||
}
|
|
||||||
if (CollUtil.isNotEmpty(taskList)) {
|
if (CollUtil.isNotEmpty(taskList)) {
|
||||||
List<String> processDefinitionIds = StreamUtils.toList(taskList, TaskVo::getProcessDefinitionId);
|
List<String> processDefinitionIds = StreamUtils.toList(taskList, TaskVo::getProcessDefinitionId);
|
||||||
WorkflowUtils.setWfDefinitionConfigVo(taskList, processDefinitionIds, PROCESS_DEFINITION_ID);
|
List<WfNodeConfigVo> wfNodeConfigVoList = iWfNodeConfigService.selectByDefIds(processDefinitionIds);
|
||||||
|
for (TaskVo task : taskList) {
|
||||||
|
task.setBusinessStatusName(BusinessStatusEnum.findByStatus(task.getBusinessStatus()));
|
||||||
|
if (CollUtil.isNotEmpty(wfNodeConfigVoList)) {
|
||||||
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && FlowConstant.TRUE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
|
wfNodeConfigVoList.stream().filter(e -> e.getDefinitionId().equals(task.getProcessDefinitionId()) && e.getNodeId().equals(task.getTaskDefinitionKey()) && FlowConstant.FALSE.equals(e.getApplyUserTask())).findFirst().ifPresent(task::setWfNodeConfigVo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return TableDataInfo.build(page);
|
return TableDataInfo.build(page);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,8 @@ public class WfNodeConfigServiceImpl implements IWfNodeConfigService {
|
|||||||
return baseMapper.deleteBatchIds(ids) > 0;
|
return baseMapper.deleteBatchIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteByDefIds(Collection<String> ids) {
|
public Boolean deleteByDefIds(Collection<String> ids) {
|
||||||
return baseMapper.delete(new LambdaQueryWrapper<WfNodeConfig>().in(WfNodeConfig::getDefinitionId, ids)) > 0;
|
return baseMapper.delete(new LambdaQueryWrapper<WfNodeConfig>().in(WfNodeConfig::getDefinitionId, ids)) > 0;
|
||||||
|
@ -156,7 +156,13 @@ public class ModelUtils {
|
|||||||
if (!(targetFlowElement instanceof UserTask) && !subtask) {
|
if (!(targetFlowElement instanceof UserTask) && !subtask) {
|
||||||
throw new ServerException("开始节点后第一个节点必须是用户任务!");
|
throw new ServerException("开始节点后第一个节点必须是用户任务!");
|
||||||
}
|
}
|
||||||
|
//开始节点后第一个节点申请人节点
|
||||||
|
if ((targetFlowElement instanceof UserTask) && !subtask) {
|
||||||
|
UserTask userTask = (UserTask) targetFlowElement;
|
||||||
|
if (StringUtils.isBlank(userTask.getFormKey())) {
|
||||||
|
throw new ServerException("申请人节点必须选择表单!");
|
||||||
|
}
|
||||||
|
}
|
||||||
List<EndEvent> endEventList = flowElements.stream().filter(EndEvent.class::isInstance).map(EndEvent.class::cast).collect(Collectors.toList());
|
List<EndEvent> endEventList = flowElements.stream().filter(EndEvent.class::isInstance).map(EndEvent.class::cast).collect(Collectors.toList());
|
||||||
if (CollUtil.isEmpty(endEventList)) {
|
if (CollUtil.isEmpty(endEventList)) {
|
||||||
throw new ServerException(subtask ? "子流程必须存在结束节点!" : "必须存在结束节点!");
|
throw new ServerException(subtask ? "子流程必须存在结束节点!" : "必须存在结束节点!");
|
||||||
@ -168,7 +174,7 @@ public class ModelUtils {
|
|||||||
*
|
*
|
||||||
* @param processDefinitionId 流程定义id
|
* @param processDefinitionId 流程定义id
|
||||||
*/
|
*/
|
||||||
public static List<UserTask> getuserTaskFlowElements(String processDefinitionId) {
|
public static List<UserTask> getUserTaskFlowElements(String processDefinitionId) {
|
||||||
BpmnModel bpmnModel = PROCESS_ENGINE.getRepositoryService().getBpmnModel(processDefinitionId);
|
BpmnModel bpmnModel = PROCESS_ENGINE.getRepositoryService().getBpmnModel(processDefinitionId);
|
||||||
List<UserTask> list = new ArrayList<>();
|
List<UserTask> list = new ArrayList<>();
|
||||||
List<Process> processes = bpmnModel.getProcesses();
|
List<Process> processes = bpmnModel.getProcesses();
|
||||||
@ -264,4 +270,20 @@ public class ModelUtils {
|
|||||||
FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(taskDefinitionKey);
|
FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(taskDefinitionKey);
|
||||||
return flowNode instanceof UserTask;
|
return flowNode instanceof UserTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取申请人节点
|
||||||
|
*
|
||||||
|
* @param processDefinitionId 流程定义id
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static UserTask getApplyUserTask(String processDefinitionId) {
|
||||||
|
BpmnModel bpmnModel = PROCESS_ENGINE.getRepositoryService().getBpmnModel(processDefinitionId);
|
||||||
|
Collection<FlowElement> flowElements = bpmnModel.getMainProcess().getFlowElements();
|
||||||
|
List<StartEvent> startEventList = flowElements.stream().filter(StartEvent.class::isInstance).map(StartEvent.class::cast).collect(Collectors.toList());
|
||||||
|
StartEvent startEvent = startEventList.get(0);
|
||||||
|
List<SequenceFlow> outgoingFlows = startEvent.getOutgoingFlows();
|
||||||
|
FlowElement targetFlowElement = outgoingFlows.get(0).getTargetFlowElement();
|
||||||
|
return (UserTask) targetFlowElement;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,6 @@ public class WorkflowUtils {
|
|||||||
private static final IWorkflowUserService WORKFLOW_USER_SERVICE = SpringUtils.getBean(IWorkflowUserService.class);
|
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 IActHiProcinstService ACT_HI_PROCINST_SERVICE = SpringUtils.getBean(IActHiProcinstService.class);
|
||||||
private static final ActHiTaskinstMapper ACT_HI_TASKINST_MAPPER = SpringUtils.getBean(ActHiTaskinstMapper.class);
|
private static final ActHiTaskinstMapper ACT_HI_TASKINST_MAPPER = SpringUtils.getBean(ActHiTaskinstMapper.class);
|
||||||
private static final IWfDefinitionConfigService I_WF_DEFINITION_CONFIG_SERVICE = SpringUtils.getBean(IWfDefinitionConfigService.class);
|
|
||||||
private static final IWfFormManageService I_WF_FORM_MANAGE_SERVICE = SpringUtils.getBean(IWfFormManageService.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建一个新任务
|
* 创建一个新任务
|
||||||
@ -292,40 +290,6 @@ public class WorkflowUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置流程流程定义配置
|
|
||||||
*
|
|
||||||
* @param obj 业务对象
|
|
||||||
* @param idList 流程定义id
|
|
||||||
* @param fieldName 流程定义ID属性名称
|
|
||||||
*/
|
|
||||||
public static void setWfDefinitionConfigVo(Object obj, List<String> idList, String fieldName) {
|
|
||||||
if (CollUtil.isEmpty(idList) || obj == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<WfDefinitionConfigVo> wfDefinitionConfigVoList = I_WF_DEFINITION_CONFIG_SERVICE.queryList(idList);
|
|
||||||
if (CollUtil.isNotEmpty(wfDefinitionConfigVoList)) {
|
|
||||||
List<Long> formIds = StreamUtils.toList(wfDefinitionConfigVoList, WfDefinitionConfigVo::getFormId);
|
|
||||||
List<WfFormManageVo> wfFormManageVos = I_WF_FORM_MANAGE_SERVICE.queryByIds(formIds);
|
|
||||||
if (CollUtil.isNotEmpty(wfFormManageVos)) {
|
|
||||||
for (WfDefinitionConfigVo wfDefinitionConfigVo : wfDefinitionConfigVoList) {
|
|
||||||
wfFormManageVos.stream().filter(e -> ObjectUtil.equals(wfDefinitionConfigVo.getFormId(), e.getId())).findFirst().ifPresent(wfDefinitionConfigVo::setWfFormManageVo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (obj instanceof Collection<?> collection) {
|
|
||||||
for (Object o : collection) {
|
|
||||||
String fieldValue = ReflectUtils.invokeGetter(o, fieldName).toString();
|
|
||||||
if (!CollUtil.isEmpty(wfDefinitionConfigVoList)) {
|
|
||||||
wfDefinitionConfigVoList.stream().filter(e -> e.getDefinitionId().equals(fieldValue)).findFirst().ifPresent(e -> {
|
|
||||||
ReflectUtils.invokeSetter(o, WF_DEFINITION_CONFIG_VO, e);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送消息
|
* 发送消息
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user