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,6 +31,7 @@ import org.springframework.util.ObjectUtils; | ||
| 31 | import org.springframework.validation.annotation.Validated; | 31 | import org.springframework.validation.annotation.Validated; |
| 32 | 32 | ||
| 33 | import javax.annotation.Resource; | 33 | import javax.annotation.Resource; |
| 34 | +import java.nio.charset.StandardCharsets; | ||
| 34 | import java.util.HashSet; | 35 | import java.util.HashSet; |
| 35 | import java.util.List; | 36 | import java.util.List; |
| 36 | import java.util.Map; | 37 | import java.util.Map; |
| @@ -148,9 +149,7 @@ public class BpmModelServiceImpl implements BpmModelService { | @@ -148,9 +149,7 @@ public class BpmModelServiceImpl implements BpmModelService { | ||
| 148 | if (StrUtil.isEmpty(bpmnXml)) { | 149 | if (StrUtil.isEmpty(bpmnXml)) { |
| 149 | return; | 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 | @Override | 155 | @Override |
yudao-admin-ui/src/views/bpm/model/index.vue
| @@ -404,7 +404,7 @@ export default { | @@ -404,7 +404,7 @@ export default { | ||
| 404 | // 重置表单 | 404 | // 重置表单 |
| 405 | this.uploadClose(); | 405 | this.uploadClose(); |
| 406 | // 提示,并刷新 | 406 | // 提示,并刷新 |
| 407 | - this.msgSuccess("导入流程模型成功"); | 407 | + this.msgSuccess("导入流程模型成功!请点击【设计流程】按钮,进行编辑保存后,才可以进行【发布流程】"); |
| 408 | this.getList(); | 408 | this.getList(); |
| 409 | }, | 409 | }, |
| 410 | uploadClose() { | 410 | uploadClose() { |
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,23 +42,4 @@ public class ActivitiUtils { | ||
| 42 | 42 | ||
| 43 | // ========== BPMN XML 相关 ========== | 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 | } |