fix(流程模型): 修复模型设置新流程分类,未更新bpmnModel信息问题 [I6CALU](https://gitee.com/KonBAI-Q/ruoyi-flowable-plus/issues/I6CALU)

This commit is contained in:
konbai
2023-02-02 23:09:29 +08:00
parent f1b6afb274
commit 653e1159fb

View File

@@ -208,12 +208,24 @@ public class WfModelServiceImpl extends FlowServiceFactory implements IWfModelSe
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateModel(WfModelBo modelBo) {
// 根据模型Key查询模型信息
Model model = repositoryService.getModel(modelBo.getModelId());
if (ObjectUtil.isNull(model)) {
throw new RuntimeException("流程模型不存在!");
}
// 修改模型分类信息
if (ObjectUtil.notEqual(model.getCategory(), modelBo.getCategory())) {
byte[] bpmnBytes = repositoryService.getModelEditorSource(model.getId());
if (ObjectUtil.isNotEmpty(bpmnBytes)) {
BpmnModel bpmnModel = ModelUtils.getBpmnModel(StrUtil.utf8Str(bpmnBytes));
// 设置最新流程分类编码
bpmnModel.setTargetNamespace(model.getCategory());
// 保存 BPMN XML
repositoryService.addModelEditorSource(model.getId(), ModelUtils.getBpmnXml(bpmnModel));
}
}
model.setCategory(modelBo.getCategory());
WfMetaInfoDto metaInfoDto = JsonUtils.parseObject(model.getMetaInfo(), WfMetaInfoDto.class);
String metaInfo = buildMetaInfo(metaInfoDto, modelBo.getDescription());