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 |   47 +++++++++++++++++++++++++----------------------
 1 files changed, 25 insertions(+), 22 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 4d23bf0..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
@@ -15,6 +15,7 @@
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.dromara.common.core.exception.ServiceException;
+import org.dromara.common.mybatis.core.page.PageQuery;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.tenant.helper.TenantHelper;
 import org.dromara.workflow.common.constant.FlowConstant;
@@ -59,7 +60,7 @@
      * @return 杩斿洖鍒嗛〉鍒楄〃
      */
     @Override
-    public TableDataInfo<Model> page(ModelBo modelBo) {
+    public TableDataInfo<Model> page(ModelBo modelBo, PageQuery pageQuery) {
         ModelQuery query = QueryUtils.modelQuery();
         if (StringUtils.isNotEmpty(modelBo.getName())) {
             query.modelNameLike("%" + modelBo.getName() + "%");
@@ -74,7 +75,7 @@
         // 鍒涘缓鏃堕棿闄嶅簭鎺掑垪
         query.orderByCreateTime().desc();
         // 鍒嗛〉鏌ヨ
-        List<Model> modelList = query.listPage(modelBo.getPageNum(), modelBo.getPageSize());
+        List<Model> modelList = query.listPage(pageQuery.getFirstNum(), pageQuery.getPageSize());
         // 鎬昏褰曟暟
         long total = query.count();
         return new TableDataInfo<>(modelList, total);
@@ -280,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