From 889bb80446bc51a60620d8c0812ef143403d32ba Mon Sep 17 00:00:00 2001 From: "shanming.sun" Date: Thu, 30 Jun 2022 20:05:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=94=BE=E5=BC=80=20projects/list?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E5=81=9A=E9=89=B4=E6=9D=83=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cloud/sonic/controller/controller/ProjectsController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/ProjectsController.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/ProjectsController.java index c5c5dfa2..10acb41b 100644 --- a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/ProjectsController.java +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/ProjectsController.java @@ -17,6 +17,7 @@ package org.cloud.sonic.controller.controller; import org.cloud.sonic.common.config.WebAspect; +import org.cloud.sonic.common.config.WhiteUrl; import org.cloud.sonic.common.exception.SonicException; import org.cloud.sonic.common.http.RespEnum; import org.cloud.sonic.common.http.RespModel; @@ -56,6 +57,7 @@ public RespModel save(@Validated @RequestBody ProjectsDTO projects) { } @WebAspect + @WhiteUrl @ApiOperation(value = "查找所有项目", notes = "查找所有项目列表") @GetMapping("/list") public RespModel> findAll() { From 5c4bb573a9ea04b7c8de8358e24634bbc7220864 Mon Sep 17 00:00:00 2001 From: ZhouYixun <291028775@qq.com> Date: Thu, 30 Jun 2022 23:48:33 +0800 Subject: [PATCH 2/3] debug --- docker-compose.yml | 2 -- docker-compose2.yml | 2 -- .../main/resources/application-sonic-server-folder.yml | 6 +----- .../sonic/controller/controller/ExchangeController.java | 2 +- .../main/java/org/cloud/sonic/folder/tools/FileTool.java | 8 ++------ 5 files changed, 4 insertions(+), 16 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c031c8b6..d82e652a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -70,8 +70,6 @@ services: - SONIC_EUREKA_PASSWORD - SONIC_EUREKA_HOST=sonic-server-eureka - SONIC_EUREKA_PORT - - SONIC_SERVER_HOST - - SONIC_SERVER_PORT - SECRET_KEY - EXPIRE_DAY networks: diff --git a/docker-compose2.yml b/docker-compose2.yml index 64826d62..158514a7 100644 --- a/docker-compose2.yml +++ b/docker-compose2.yml @@ -70,8 +70,6 @@ services: - SONIC_EUREKA_PASSWORD - SONIC_EUREKA_HOST=sonic-server-eureka - SONIC_EUREKA_PORT - - SONIC_SERVER_HOST - - SONIC_SERVER_PORT - SECRET_KEY - EXPIRE_DAY networks: diff --git a/sonic-server-common/src/main/resources/application-sonic-server-folder.yml b/sonic-server-common/src/main/resources/application-sonic-server-folder.yml index 4b6ddea6..291596c2 100644 --- a/sonic-server-common/src/main/resources/application-sonic-server-folder.yml +++ b/sonic-server-common/src/main/resources/application-sonic-server-folder.yml @@ -5,8 +5,4 @@ spring: servlet: multipart: maxFileSize: -1 - maxRequestSize: -1 - -# 网关的IP地址 -gateway: - host: http://${SONIC_SERVER_HOST:localhost}:${SONIC_SERVER_PORT:3000}/server \ No newline at end of file + maxRequestSize: -1 \ No newline at end of file diff --git a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/ExchangeController.java b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/ExchangeController.java index fa06a824..32755bd9 100644 --- a/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/ExchangeController.java +++ b/sonic-server-controller/src/main/java/org/cloud/sonic/controller/controller/ExchangeController.java @@ -37,7 +37,7 @@ import javax.websocket.Session; -@Api(tags = "设备管理相关") +@Api(tags = "调度相关") @RestController @RequestMapping("/exchange") @Slf4j diff --git a/sonic-server-folder/src/main/java/org/cloud/sonic/folder/tools/FileTool.java b/sonic-server-folder/src/main/java/org/cloud/sonic/folder/tools/FileTool.java index bc7cb9e8..2f2c6168 100644 --- a/sonic-server-folder/src/main/java/org/cloud/sonic/folder/tools/FileTool.java +++ b/sonic-server-folder/src/main/java/org/cloud/sonic/folder/tools/FileTool.java @@ -41,8 +41,6 @@ @RefreshScope public class FileTool { private final Logger logger = LoggerFactory.getLogger(FileTool.class); - @Value("${gateway.host}") - private String host; /** * @param folderName 文件夹 @@ -68,8 +66,7 @@ public String upload(String folderName, MultipartFile file) throws IOException { } catch (FileAlreadyExistsException e) { logger.error(e.getMessage()); } - host = host.replace(":80/", "/"); - return host + "/api/folder/" + local.getPath().replaceAll("\\\\", "/"); + return "/folder/" + local.getPath().replaceAll("\\\\", "/"); } /** @@ -161,7 +158,6 @@ public String merge(String uuid, String fileName, int totalCount) { } catch (IOException e) { logger.error(e.getMessage()); } - host = host.replace(":80/", "/"); - return host + "/api/folder/" + file.getPath(); + return "/folder/" + file.getPath(); } } From 43e865e45dacd754a53d9c0b8af2bdc5c9ff3d33 Mon Sep 17 00:00:00 2001 From: ZhouYixun <291028775@qq.com> Date: Fri, 1 Jul 2022 23:01:11 +0800 Subject: [PATCH 3/3] revert --- docker-compose.yml | 2 ++ docker-compose2.yml | 2 ++ .../main/resources/application-sonic-server-folder.yml | 6 +++++- .../main/java/org/cloud/sonic/folder/tools/FileTool.java | 8 ++++++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d82e652a..c031c8b6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -70,6 +70,8 @@ services: - SONIC_EUREKA_PASSWORD - SONIC_EUREKA_HOST=sonic-server-eureka - SONIC_EUREKA_PORT + - SONIC_SERVER_HOST + - SONIC_SERVER_PORT - SECRET_KEY - EXPIRE_DAY networks: diff --git a/docker-compose2.yml b/docker-compose2.yml index 158514a7..64826d62 100644 --- a/docker-compose2.yml +++ b/docker-compose2.yml @@ -70,6 +70,8 @@ services: - SONIC_EUREKA_PASSWORD - SONIC_EUREKA_HOST=sonic-server-eureka - SONIC_EUREKA_PORT + - SONIC_SERVER_HOST + - SONIC_SERVER_PORT - SECRET_KEY - EXPIRE_DAY networks: diff --git a/sonic-server-common/src/main/resources/application-sonic-server-folder.yml b/sonic-server-common/src/main/resources/application-sonic-server-folder.yml index 291596c2..4b6ddea6 100644 --- a/sonic-server-common/src/main/resources/application-sonic-server-folder.yml +++ b/sonic-server-common/src/main/resources/application-sonic-server-folder.yml @@ -5,4 +5,8 @@ spring: servlet: multipart: maxFileSize: -1 - maxRequestSize: -1 \ No newline at end of file + maxRequestSize: -1 + +# 网关的IP地址 +gateway: + host: http://${SONIC_SERVER_HOST:localhost}:${SONIC_SERVER_PORT:3000}/server \ No newline at end of file diff --git a/sonic-server-folder/src/main/java/org/cloud/sonic/folder/tools/FileTool.java b/sonic-server-folder/src/main/java/org/cloud/sonic/folder/tools/FileTool.java index 2f2c6168..bc7cb9e8 100644 --- a/sonic-server-folder/src/main/java/org/cloud/sonic/folder/tools/FileTool.java +++ b/sonic-server-folder/src/main/java/org/cloud/sonic/folder/tools/FileTool.java @@ -41,6 +41,8 @@ @RefreshScope public class FileTool { private final Logger logger = LoggerFactory.getLogger(FileTool.class); + @Value("${gateway.host}") + private String host; /** * @param folderName 文件夹 @@ -66,7 +68,8 @@ public String upload(String folderName, MultipartFile file) throws IOException { } catch (FileAlreadyExistsException e) { logger.error(e.getMessage()); } - return "/folder/" + local.getPath().replaceAll("\\\\", "/"); + host = host.replace(":80/", "/"); + return host + "/api/folder/" + local.getPath().replaceAll("\\\\", "/"); } /** @@ -158,6 +161,7 @@ public String merge(String uuid, String fileName, int totalCount) { } catch (IOException e) { logger.error(e.getMessage()); } - return "/folder/" + file.getPath(); + host = host.replace(":80/", "/"); + return host + "/api/folder/" + file.getPath(); } }