mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2025-09-30 15:16:41 +08:00
删除无用依赖,优化模型修改,导出,部署非空校验
This commit is contained in:
parent
664a713683
commit
1f7d8b52af
@ -17,8 +17,7 @@
|
||||
</description>
|
||||
|
||||
<properties>
|
||||
<xerces.version>2.11.0</xerces.version>
|
||||
<batik.version>1.10</batik.version>
|
||||
<flowable.version>6.8.0</flowable.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -35,49 +34,25 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.flowable</groupId>
|
||||
<artifactId>flowable-ui-modeler-rest</artifactId>
|
||||
<version>6.8.0</version>
|
||||
</dependency>
|
||||
<!-- 绘制flowable流程图 -->
|
||||
<dependency>
|
||||
<groupId>org.flowable</groupId>
|
||||
<artifactId>flowable-image-generator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- flowable json 转换 -->
|
||||
<dependency>
|
||||
<groupId>org.flowable</groupId>
|
||||
<artifactId>flowable-json-converter</artifactId>
|
||||
<version>${flowable.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--系统模块-->
|
||||
<dependency>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- svg转png图片工具-->
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>batik-all</artifactId>
|
||||
<version>${batik.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--解决部署xml错误-->
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>${xerces.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flowable</groupId>
|
||||
<artifactId>flowable-json-converter</artifactId>
|
||||
<version>6.8.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -108,7 +108,7 @@ public class ActModelServiceImpl implements IActModelService {
|
||||
String description = modelBo.getDescription();
|
||||
Model checkModel = repositoryService.createModelQuery().modelKey(key).modelTenantId(LoginHelper.getTenantId()).singleResult();
|
||||
if (ObjectUtil.isNotNull(checkModel)) {
|
||||
throw new ServiceException("模型key已存在!");
|
||||
throw new ServiceException("模型key已存在!");
|
||||
}
|
||||
// 1. 初始空的模型
|
||||
Model model = repositoryService.newModel();
|
||||
@ -213,13 +213,17 @@ public class ActModelServiceImpl implements IActModelService {
|
||||
String key = values.getFirst("key");
|
||||
List<Model> list = repositoryService.createModelQuery().modelKey(key).modelTenantId(LoginHelper.getTenantId()).list();
|
||||
list.stream().filter(e -> !e.getId().equals(model.getId())).findFirst().ifPresent(e -> {
|
||||
throw new ServiceException("模型key已存在!");
|
||||
throw new ServiceException("模型key已存在!");
|
||||
});
|
||||
model.setKey(key);
|
||||
repositoryService.saveModel(model);
|
||||
byte[] xmlBytes = WorkflowUtils.bpmnJsonToXmlBytes(Objects.requireNonNull(values.getFirst("json_xml")).getBytes(StandardCharsets.UTF_8));
|
||||
if (ArrayUtil.isEmpty(xmlBytes)) {
|
||||
throw new ServiceException("模型不能为空!");
|
||||
throw new ServiceException("模型不能为空!");
|
||||
}
|
||||
byte[] toXmlBytes = WorkflowUtils.bpmnJsonToXmlBytes(xmlBytes);
|
||||
if (ArrayUtil.isEmpty(toXmlBytes)) {
|
||||
throw new ServiceException("模型不能为空,请至少设计一条主线流程!");
|
||||
}
|
||||
repositoryService.addModelEditorSource(model.getId(), xmlBytes);
|
||||
return true;
|
||||
@ -244,6 +248,10 @@ public class ActModelServiceImpl implements IActModelService {
|
||||
if (ArrayUtil.isEmpty(xmlBytes)) {
|
||||
throw new ServiceException("模型数据为空,请先设计流程定义模型,再进行部署!");
|
||||
}
|
||||
byte[] toXmlBytes = WorkflowUtils.bpmnJsonToXmlBytes(xmlBytes);
|
||||
if (ArrayUtil.isEmpty(toXmlBytes)) {
|
||||
throw new ServiceException("模型不能为空,请至少设计一条主线流程!");
|
||||
}
|
||||
// 查询模型的基本信息
|
||||
Model model = repositoryService.getModel(id);
|
||||
// xml资源的名称 ,对应act_ge_bytearray表中的name_字段
|
||||
@ -287,11 +295,17 @@ public class ActModelServiceImpl implements IActModelService {
|
||||
String zipName = "模型不存在";
|
||||
//查询模型基本信息
|
||||
Model model = repositoryService.getModel(modelId);
|
||||
byte[] xmlBytes = repositoryService.getModelEditorSource(modelId);
|
||||
if (ObjectUtil.isNotNull(model)) {
|
||||
// 查询流程定义模型的json字节码
|
||||
byte[] xmlBytes = repositoryService.getModelEditorSource(modelId);
|
||||
if (ArrayUtil.isEmpty(xmlBytes)) {
|
||||
byte[] toXmlBytes = WorkflowUtils.bpmnJsonToXmlBytes(xmlBytes);
|
||||
if (ArrayUtil.isEmpty(toXmlBytes)) {
|
||||
zipName = "模型不能为空,请至少设计一条主线流程!";
|
||||
zos.putNextEntry(new ZipEntry(zipName + ".txt"));
|
||||
zos.write(zipName.getBytes(StandardCharsets.UTF_8));
|
||||
} else if (ArrayUtil.isEmpty(xmlBytes)) {
|
||||
zipName = "模型数据为空,请先设计流程定义模型,再进行部署!";
|
||||
zos.putNextEntry(new ZipEntry(zipName + ".txt"));
|
||||
zos.write(zipName.getBytes(StandardCharsets.UTF_8));
|
||||
} else {
|
||||
String fileName = model.getName() + "-" + model.getKey();
|
||||
// 压缩包文件名
|
||||
|
Loading…
Reference in New Issue
Block a user