From 7a47c3a2ce92b098447cbf874d4d6d7938cda9c2 Mon Sep 17 00:00:00 2001 From: 13405411873 <1994398261@qq.com> Date: Sun, 30 Mar 2025 22:12:50 +0800 Subject: [PATCH] =?UTF-8?q?bug=20=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 + ruoyi-admin/pom.xml | 25 +++++- .../impl/PatientScriptServiceImpl.java | 38 ++++++++- ruoyi-ui/src/components/BrainUpload/index.vue | 2 +- ruoyi-ui/src/views/system/shMenu/index.vue | 83 +------------------ 5 files changed, 67 insertions(+), 83 deletions(-) diff --git a/pom.xml b/pom.xml index d7bf23c..17b6a50 100644 --- a/pom.xml +++ b/pom.xml @@ -100,6 +100,8 @@ ${poi.version} + + org.apache.velocity diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index f5db196..50cedab 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -19,8 +19,31 @@ org.apache.commons commons-compress - 1.21 + 1.21 + + com.github.junrar + junrar + 7.4.0 + + + org.apache.ant + ant + 1.10.12 + + + + ant-contrib + ant-contrib + 1.0b3 + + + ant + ant + + + + com.tencentcloudapi diff --git a/ruoyi-admin/src/main/java/com/ruoyi/script/service/impl/PatientScriptServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/script/service/impl/PatientScriptServiceImpl.java index 93e3f9b..c85a398 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/script/service/impl/PatientScriptServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/script/service/impl/PatientScriptServiceImpl.java @@ -3,6 +3,9 @@ package com.ruoyi.script.service.impl; import cn.hutool.core.date.DateUtil; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.data.Pictures; +import com.github.junrar.Archive; +import com.github.junrar.exception.RarException; +import com.github.junrar.rarfile.FileHeader; import com.itextpdf.text.*; import com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfChunk; @@ -92,6 +95,34 @@ public class PatientScriptServiceImpl implements PatientScriptService { } } + + public static void unrar(String rarFilePath, String destDir) throws IOException, RarException { + File rarFile = new File(rarFilePath); + File destDirectory = new File(destDir); + + if (!destDirectory.exists()) { + destDirectory.mkdirs(); + } + + try (Archive archive = new Archive(rarFile)) { + FileHeader fileHeader; + while ((fileHeader = archive.nextFileHeader()) != null) { + if (!fileHeader.isDirectory()) { + File outFile = new File(destDirectory, fileHeader.getFileNameString()); + File parent = outFile.getParentFile(); + if (!parent.exists()) { + parent.mkdirs(); + } + try (OutputStream out = new FileOutputStream(outFile)) { + archive.extractFile(fileHeader, out); + } catch (IOException e) { + throw new RuntimeException("解压文件时出错: " + fileHeader.getFileNameString(), e); + } + } + } + } + } + @Override public Boolean save(PatientScript patientScript) throws IOException, InterruptedException { patientScript.setCreateId(1110L); @@ -108,7 +139,12 @@ public class PatientScriptServiceImpl implements PatientScriptService { String unique_id = generateOtp(); String playground = "playground"+unique_id; String format = DateUtil.format(new Date(), "yyyy-MM-dd"); - unzip(patientScript.getFilePath(),"/data/" +format+"/"+ playground+"/个体数据"); + //判断是zip还是rar + if (patientScript.getFilePath().endsWith(".zip")){ + unzip(patientScript.getFilePath(),"/data/" +format+"/"+ playground+"/个体数据"); + }else if (patientScript.getFilePath().endsWith(".rar")){ + unrar(patientScript.getFilePath(),"/data/" +format+"/"+ playground+"/个体数据"); + } Map shMap = new LinkedHashMap<>(); shMap.put("outPath",format+"/output-"+unique_id); shMap.put("filePath", patientScript.getFilePath()); diff --git a/ruoyi-ui/src/components/BrainUpload/index.vue b/ruoyi-ui/src/components/BrainUpload/index.vue index bb313ea..b505bc3 100644 --- a/ruoyi-ui/src/components/BrainUpload/index.vue +++ b/ruoyi-ui/src/components/BrainUpload/index.vue @@ -50,7 +50,7 @@ // 文件类型, 例如['png', 'jpg', 'jpeg'] fileType: { type: Array, - default: () => ["zip"], + default: () => ["zip","rar"], }, // 是否显示提示 isShowTip: { diff --git a/ruoyi-ui/src/views/system/shMenu/index.vue b/ruoyi-ui/src/views/system/shMenu/index.vue index 40d96e5..67d640b 100644 --- a/ruoyi-ui/src/views/system/shMenu/index.vue +++ b/ruoyi-ui/src/views/system/shMenu/index.vue @@ -120,23 +120,6 @@ - - - - - - - - - - - - - - - - - @@ -233,20 +216,8 @@ trigger: "blur", }, ], - patientAge: [ - { - required: true, - message: "患者年龄不能为空", - trigger: "blur", - }, - ], - patientCard: [ - { - required: true, - message: "证件信息号不能为空", - trigger: "blur", - }, - ], + + scanTime: [ { required: true, @@ -254,13 +225,7 @@ trigger: "blur", }, ], - blOrder: [ - { - required: true, - message: "病历号不能为空", - trigger: "blur", - }, - ], + scanPosition: [ { required: true, @@ -268,48 +233,6 @@ trigger: "blur", }, ], - scanDoctor: [ - { - required: true, - message: "扫描医生不能为空", - trigger: "blur", - }, - ], - zdDoctor: [ - { - required: true, - message: "诊断医师不能为空", - trigger: "blur", - }, - ], - shDoctor: [ - { - required: true, - message: "审核医生不能为空", - trigger: "blur", - }, - ], - repetitionTime: [ - { - required: true, - message: "TR不能为空", - trigger: "blur", - }, - ], - scanningOrder: [ - { - required: true, - message: "扫描顺序不能为空", - trigger: "blur", - }, - ], - sliceNumber: [ - { - required: true, - message: "参考切片层数不能为空", - trigger: "blur", - }, - ], filePath: [ { required: true,