From 915735cd579637ee239f904874ba3f27b1ac2a18 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Fri, 06 Oct 2023 15:03:23 +0800
Subject: [PATCH] 英文返回提示修改为中文

---
 src/main/java/com/dji/sample/wayline/service/impl/WaylineFileServiceImpl.java |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/dji/sample/wayline/service/impl/WaylineFileServiceImpl.java b/src/main/java/com/dji/sample/wayline/service/impl/WaylineFileServiceImpl.java
index a4ec7f7..8267a90 100644
--- a/src/main/java/com/dji/sample/wayline/service/impl/WaylineFileServiceImpl.java
+++ b/src/main/java/com/dji/sample/wayline/service/impl/WaylineFileServiceImpl.java
@@ -93,7 +93,7 @@
     public URL getObjectUrl(String workspaceId, String waylineId) throws SQLException {
         Optional<WaylineFileDTO> waylineOpt = this.getWaylineByWaylineId(workspaceId, waylineId);
         if (waylineOpt.isEmpty()) {
-            throw new SQLException(waylineId + " does not exist.");
+            throw new SQLException(waylineId + " 不存在");
         }
         return ossService.getObjectUrl(OssConfiguration.bucket, waylineOpt.get().getObjectKey());
     }
@@ -107,8 +107,8 @@
         if (!StringUtils.hasText(file.getSign())) {
             try (InputStream object = ossService.getObject(OssConfiguration.bucket, metadata.getObjectKey())) {
                 if (object.available() == 0) {
-                    throw new RuntimeException("The file " + metadata.getObjectKey() +
-                            " does not exist in the bucket[" + OssConfiguration.bucket + "].");
+                    throw new RuntimeException("文件" + metadata.getObjectKey() +
+                            " 在空间中不存在[" + OssConfiguration.bucket + "].");
                 }
                 file.setSign(DigestUtils.md5DigestAsHex(object));
             } catch (IOException e) {
@@ -164,7 +164,7 @@
     public void importKmzFile(MultipartFile file, String workspaceId, String creator) {
         Optional<WaylineFileDTO> waylineFileOpt = validKmzFile(file);
         if (waylineFileOpt.isEmpty()) {
-            throw new RuntimeException("The file format is incorrect.");
+            throw new RuntimeException("文件格式错误");
         }
 
         try {
@@ -182,7 +182,7 @@
     private Optional<WaylineFileDTO> validKmzFile(MultipartFile file) {
         String filename = file.getOriginalFilename();
         if (Objects.nonNull(filename) && !filename.endsWith(WAYLINE_FILE_SUFFIX)) {
-            throw new RuntimeException("The file format is incorrect.");
+            throw new RuntimeException("文件格式错误");
         }
         try (ZipInputStream unzipFile = new ZipInputStream(file.getInputStream(), StandardCharsets.UTF_8)) {
 
@@ -196,13 +196,13 @@
                 SAXReader reader = new SAXReader();
                 Document document = reader.read(unzipFile);
                 if (!StandardCharsets.UTF_8.name().equals(document.getXMLEncoding())) {
-                    throw new RuntimeException("The file encoding format is incorrect.");
+                    throw new RuntimeException("文件编码格式错误");
                 }
 
                 Node droneNode = document.selectSingleNode("//" + KmzFileProperties.TAG_WPML_PREFIX + KmzFileProperties.TAG_DRONE_INFO);
                 Node payloadNode = document.selectSingleNode("//" + KmzFileProperties.TAG_WPML_PREFIX + KmzFileProperties.TAG_PAYLOAD_INFO);
                 if (Objects.isNull(droneNode) || Objects.isNull(payloadNode)) {
-                    throw new RuntimeException("The file format is incorrect.");
+                    throw new RuntimeException("文件格式错误");
                 }
 
                 String type = droneNode.valueOf(KmzFileProperties.TAG_WPML_PREFIX + KmzFileProperties.TAG_DRONE_ENUM_VALUE);
@@ -214,7 +214,7 @@
                 if (!StringUtils.hasText(type) || !StringUtils.hasText(subType) ||
                         !StringUtils.hasText(payloadSubType) || !StringUtils.hasText(payloadType) ||
                         !StringUtils.hasText(templateType)) {
-                    throw new RuntimeException("The file format is incorrect.");
+                    throw new RuntimeException("文件格式错误");
                 }
 
                 return Optional.of(WaylineFileDTO.builder()

--
Gitblit v1.9.3