feat(流程表单): 部署流程表单新增表单名称属性,流程详情历史表单新增表单名显示。

This commit is contained in:
konbai
2023-01-15 15:24:32 +08:00
parent b2b0d91ad8
commit be8f436092
4 changed files with 21 additions and 12 deletions

View File

@@ -29,6 +29,11 @@ public class WfDeployForm {
*/ */
private String nodeKey; private String nodeKey;
/**
* 表单名称
*/
private String formName;
/** /**
* 节点名称 * 节点名称
*/ */

View File

@@ -28,6 +28,11 @@ public class WfDeployFormVo {
*/ */
private String nodeKey; private String nodeKey;
/**
* 表单名称
*/
private String formName;
/** /**
* 节点名称 * 节点名称
*/ */

View File

@@ -113,12 +113,7 @@ public class WfDeployFormServiceImpl implements IWfDeployFormService {
* @return 部署表单关联对象。若无表单信息formKey则返回null * @return 部署表单关联对象。若无表单信息formKey则返回null
*/ */
private WfDeployForm buildDeployForm(String deployId, FlowNode node) { private WfDeployForm buildDeployForm(String deployId, FlowNode node) {
String formKey = null; String formKey = ModelUtils.getFormKey(node);
if (node instanceof StartEvent) {
formKey = ((StartEvent) node).getFormKey();
} else if (node instanceof UserTask) {
formKey = ((UserTask) node).getFormKey();
}
if (StringUtils.isEmpty(formKey)) { if (StringUtils.isEmpty(formKey)) {
return null; return null;
} }
@@ -129,9 +124,10 @@ public class WfDeployFormServiceImpl implements IWfDeployFormService {
} }
WfDeployForm deployForm = new WfDeployForm(); WfDeployForm deployForm = new WfDeployForm();
deployForm.setDeployId(deployId); deployForm.setDeployId(deployId);
deployForm.setNodeKey(node.getId());
deployForm.setNodeName(node.getName());
deployForm.setFormKey(formKey); deployForm.setFormKey(formKey);
deployForm.setNodeKey(node.getId());
deployForm.setFormName(wfForm.getFormName());
deployForm.setNodeName(node.getName());
deployForm.setContent(wfForm.getContent()); deployForm.setContent(wfForm.getContent());
return deployForm; return deployForm;
} }

View File

@@ -736,16 +736,19 @@ public class WfProcessServiceImpl extends FlowServiceFactory implements IWfProce
variables = historicProcIns.getProcessVariables(); variables = historicProcIns.getProcessVariables();
processFormKeys.add(formKey); processFormKeys.add(formKey);
} }
// 兼容旧版数据,旧版此处查询可能出现多条 // 非节点表单此处查询结果可能有多条,只获取第一条信息
List<WfDeployFormVo> formInfoList = deployFormMapper.selectVoList(new LambdaQueryWrapper<WfDeployForm>() List<WfDeployFormVo> formInfoList = deployFormMapper.selectVoList(new LambdaQueryWrapper<WfDeployForm>()
.eq(WfDeployForm::getDeployId, deployId) .eq(WfDeployForm::getDeployId, deployId)
.eq(WfDeployForm::getFormKey, formKey) .eq(WfDeployForm::getFormKey, formKey)
.eq(localScope, WfDeployForm::getNodeKey, flowElement.getId())); .eq(localScope, WfDeployForm::getNodeKey, flowElement.getId()));
if (CollUtil.isNotEmpty(formInfoList)) { WfDeployFormVo formInfo = formInfoList.iterator().next();
WfDeployFormVo formInfo = formInfoList.get(0); if (ObjectUtil.isNotNull(formInfo)) {
// 旧数据 formInfo.getFormName() 为 null
String formName = Optional.ofNullable(formInfo.getFormName()).orElse(StringUtils.EMPTY);
String title = localScope ? formName.concat("(" + flowElement.getName() + ")") : formName;
FormConf formConf = JsonUtils.parseObject(formInfo.getContent(), FormConf.class); FormConf formConf = JsonUtils.parseObject(formInfo.getContent(), FormConf.class);
if (null != formConf) { if (null != formConf) {
formConf.setTitle(flowElement.getName()); formConf.setTitle(title);
formConf.setDisabled(true); formConf.setDisabled(true);
formConf.setFormBtns(false); formConf.setFormBtns(false);
ProcessFormUtils.fillFormData(formConf, variables); ProcessFormUtils.fillFormData(formConf, variables);