From 295ea28703c6a94044ca277402e0c5f7e6a6af93 Mon Sep 17 00:00:00 2001 From: xlsea Date: Mon, 27 May 2024 15:34:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=87=8D=E8=AF=95?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=8E=A5=E5=8F=A3=E6=95=B0=E6=8D=AE=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/web/controller/SceneConfigController.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/controller/SceneConfigController.java b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/controller/SceneConfigController.java index 62a0a4a8..eeba1476 100644 --- a/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/controller/SceneConfigController.java +++ b/snail-job-server/snail-job-server-web/src/main/java/com/aizuda/snailjob/server/web/controller/SceneConfigController.java @@ -80,9 +80,9 @@ public class SceneConfigController { return sceneConfigService.updateSceneConfig(requestVO); } - @PostMapping("/import") @LoginRequired - public void importScene(final MultipartFile file) throws IOException { + @PostMapping(value = "/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + public void importScene(@RequestPart("file") MultipartFile file) throws IOException { if (file.isEmpty()) { throw new SnailJobCommonException("Please select a file to upload"); } @@ -95,7 +95,7 @@ public class SceneConfigController { JsonNode node = JsonUtil.toJson(file.getBytes()); List requestList = JsonUtil.parseList(JsonUtil.toJsonString(node), - SceneConfigRequestVO.class); + SceneConfigRequestVO.class); // 校验参数是否合法 for (final SceneConfigRequestVO sceneConfigRequestVO : requestList) { @@ -123,11 +123,11 @@ public class SceneConfigController { // 设置下载时的文件名称 String fileName = String.format("retry-scene-%s.json", DateUtils.toNowFormat(DateUtils.PURE_DATETIME_MS_PATTERN)); String disposition = "attachment; filename=" + - new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1); + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1); headers.add(HttpHeaders.CONTENT_DISPOSITION, disposition); return ResponseEntity.ok() - .headers(headers) - .body(configs); + .headers(headers) + .body(configs); } }