From adae16140c0b702be0ab13cd566b19221280301e Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 20 Sep 2024 15:48:06 +0800 Subject: [PATCH] =?UTF-8?q?modify:=201.=20=E4=BF=A1=E4=BA=A7=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8B=E8=BD=BD=E4=B8=B4=E6=97=B6=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hz-pm-api/src/main/java/com/hz/pm/api/external/MhFileClient.java | 7 +++---- .../com/hz/pm/api/projectlib/controller/QxProjectController.java | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/MhFileClient.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/MhFileClient.java index f83283e..11cfeb5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/MhFileClient.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/MhFileClient.java @@ -1,11 +1,10 @@ package com.hz.pm.api.external; import cn.hutool.core.io.FileUtil; -import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.resource.ClassPathResource; import cn.hutool.core.lang.TypeReference; -import cn.hutool.core.lang.UUID; import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; @@ -21,7 +20,6 @@ import org.springframework.stereotype.Component; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayOutputStream; import java.io.File; import java.util.Arrays; import java.util.Collections; @@ -76,7 +74,8 @@ public class MhFileClient { try { List files = listFileInfo(fileId); MhFileInfoDTO file = files.get(0); - String tmpFilePath = FileUtil.getTmpDirPath() + file.getFileName() + "." + file.getFileSuffix(); + String tmpDirPath = StrUtil.appendIfMissing(FileUtil.getTmpDirPath(), "/"); + String tmpFilePath = tmpDirPath + file.getFileName() + "." + file.getFileSuffix(); File tmpFile = new File(tmpFilePath); long size = HttpUtil.downloadFile(fileUrl, tmpFile); log.info("下载文件:{},大小为:{}", fileId, size); diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/QxProjectController.java b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/QxProjectController.java index 084f101..7f96be2 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/QxProjectController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/projectlib/controller/QxProjectController.java @@ -81,7 +81,7 @@ public class QxProjectController { return qxProjectManage.listReplaceInfo(projectId); } - @PostMapping("importProject") + @PostMapping("/importProject") @ApiOperation("导入项目") @PreAuthorize("hasAuthority('SUPER_ADMIN')") public void importProject(MultipartFile file) {