Commit d2a8f3f2533eebda20392422d66a78322ece7f84
1 parent
62b720a5
BPM 模型重构 2:导入流程时,只填写 name、description、key
Showing
3 changed files
with
3 additions
and
23 deletions
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmModelServiceImpl.java
| ... | ... | @@ -31,6 +31,7 @@ import org.springframework.util.ObjectUtils; |
| 31 | 31 | import org.springframework.validation.annotation.Validated; |
| 32 | 32 | |
| 33 | 33 | import javax.annotation.Resource; |
| 34 | +import java.nio.charset.StandardCharsets; | |
| 34 | 35 | import java.util.HashSet; |
| 35 | 36 | import java.util.List; |
| 36 | 37 | import java.util.Map; |
| ... | ... | @@ -148,9 +149,7 @@ public class BpmModelServiceImpl implements BpmModelService { |
| 148 | 149 | if (StrUtil.isEmpty(bpmnXml)) { |
| 149 | 150 | return; |
| 150 | 151 | } |
| 151 | - byte[] bpmnBytes = ActivitiUtils.replaceBpmnMainProcessIdAndName(bpmnXml, | |
| 152 | - model.getKey(), model.getName()); | |
| 153 | - repositoryService.addModelEditorSource(model.getId(), bpmnBytes); | |
| 152 | + repositoryService.addModelEditorSource(model.getId(), bpmnXml.getBytes(StandardCharsets.UTF_8)); | |
| 154 | 153 | } |
| 155 | 154 | |
| 156 | 155 | @Override | ... | ... |
yudao-admin-ui/src/views/bpm/model/index.vue
yudao-framework/yudao-spring-boot-starter-activiti/src/main/java/cn/iocoder/yudao/framework/activiti/core/util/ActivitiUtils.java
| ... | ... | @@ -42,23 +42,4 @@ public class ActivitiUtils { |
| 42 | 42 | |
| 43 | 43 | // ========== BPMN XML 相关 ========== |
| 44 | 44 | |
| 45 | - /** | |
| 46 | - * 替换 BPMN XML 主流程的 id 和 name 属性 | |
| 47 | - * | |
| 48 | - * @param bpmnXml 原始的 BPMN XML 字符串 | |
| 49 | - * @param id 编号,对应到 XML 实际是 key 属性 | |
| 50 | - * @param name 名字 | |
| 51 | - * @return 新的 BPMN XML 的字节数组 | |
| 52 | - */ | |
| 53 | - public static byte[] replaceBpmnMainProcessIdAndName(String bpmnXml, String id, String name) { | |
| 54 | - // 转换成 BpmnModel 对象 | |
| 55 | - BpmnXMLConverter converter = new BpmnXMLConverter(); | |
| 56 | - BpmnModel bpmnModel = converter.convertToBpmnModel(new StringStreamSource(bpmnXml), true, true); | |
| 57 | - // 设置 id 和 name 属性 | |
| 58 | - bpmnModel.getMainProcess().setId(id); | |
| 59 | - bpmnModel.getMainProcess().setName(name); | |
| 60 | - // 转换回字节数组 | |
| 61 | - return converter.convertToXML(bpmnModel); | |
| 62 | - } | |
| 63 | - | |
| 64 | 45 | } | ... | ... |