From f3207649fffad5b908c07a3035d71cbf0b767bd0 Mon Sep 17 00:00:00 2001
From: gssong <1742057357@qq.com>
Date: 星期六, 16 三月 2024 21:59:53 +0800
Subject: [PATCH] update 调整模型部署,模型导出批量导出,上传

---
 ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActModelServiceImpl.java |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActModelServiceImpl.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActModelServiceImpl.java
index 93934c9..595c993 100644
--- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActModelServiceImpl.java
+++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/service/impl/ActModelServiceImpl.java
@@ -281,35 +281,37 @@
     /**
      * 瀵煎嚭妯″瀷zip鍘嬬缉鍖�
      *
-     * @param modelId  妯″瀷id
+     * @param modelIds  妯″瀷id
      * @param response 鐩稿簲
      */
     @Override
-    public void exportZip(String modelId, HttpServletResponse response) {
+    public void exportZip(List<String> modelIds, HttpServletResponse response) {
         ZipOutputStream zos = null;
         try {
             zos = ZipUtil.getZipOutputStream(response.getOutputStream(), StandardCharsets.UTF_8);
             // 鍘嬬缉鍖呮枃浠跺悕
             String zipName = "妯″瀷涓嶅瓨鍦�";
             // 鏌ヨ妯″瀷鍩烘湰淇℃伅
-            Model model = repositoryService.getModel(modelId);
-            byte[] xmlBytes = repositoryService.getModelEditorSource(modelId);
-            if (ObjectUtil.isNotNull(model)) {
-                if (JSONUtil.isTypeJSON(IOUtils.toString(xmlBytes, StandardCharsets.UTF_8.toString())) && ArrayUtil.isEmpty(ModelUtils.bpmnJsonToXmlBytes(xmlBytes))) {
-                    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();
-                    // 鍘嬬缉鍖呮枃浠跺悕
-                    zipName = fileName + ".zip";
-                    // 灏唜ml娣诲姞鍒板帇缂╁寘涓�(鎸囧畾xml鏂囦欢鍚嶏細璇峰亣娴佺▼.bpmn20.xml
-                    zos.putNextEntry(new ZipEntry(fileName + ".bpmn20.xml"));
-                    zos.write(xmlBytes);
+            for (String modelId : modelIds) {
+                Model model = repositoryService.getModel(modelId);
+                byte[] xmlBytes = repositoryService.getModelEditorSource(modelId);
+                if (ObjectUtil.isNotNull(model)) {
+                    if (JSONUtil.isTypeJSON(IOUtils.toString(xmlBytes, StandardCharsets.UTF_8.toString())) && ArrayUtil.isEmpty(ModelUtils.bpmnJsonToXmlBytes(xmlBytes))) {
+                        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();
+                        // 鍘嬬缉鍖呮枃浠跺悕
+                        zipName = fileName + ".zip";
+                        // 灏唜ml娣诲姞鍒板帇缂╁寘涓�(鎸囧畾xml鏂囦欢鍚嶏細璇峰亣娴佺▼.bpmn20.xml
+                        zos.putNextEntry(new ZipEntry(fileName + ".bpmn20.xml"));
+                        zos.write(xmlBytes);
+                    }
                 }
             }
             response.setHeader("Content-Disposition",

--
Gitblit v1.9.3