From f19a467300b34e71f04eab18b3ea2bafaa8cee77 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Tue, 1 Jul 2025 10:47:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gather/report/pojo/enums/ReportResponseEnum.java | 10 +++++----- .../report/service/impl/PqReportServiceImpl.java | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/report/pojo/enums/ReportResponseEnum.java b/detection/src/main/java/com/njcn/gather/report/pojo/enums/ReportResponseEnum.java index 2892943e..85b0097d 100644 --- a/detection/src/main/java/com/njcn/gather/report/pojo/enums/ReportResponseEnum.java +++ b/detection/src/main/java/com/njcn/gather/report/pojo/enums/ReportResponseEnum.java @@ -20,11 +20,11 @@ public enum ReportResponseEnum { REPORT_TEMPLATE_NOT_EXIST("A012009", "报告模板缺失,请联系管理员!"), NO_CHECK_DATA("A012010", "没有检测数据,无法生成报告!"), FILE_RENAME_FAILED("A012011", "文件重命名失败"), - REPORT_NAME_PATTERN_ERROR("A012012","报告名称格式错误,可包含中文、字母、数字、中划线、点号、空格,长度不能超过32个字符"), - REPORT_VERSION_PATTERN_ERROR("A012013","报告版本号格式错误,可包含中文、字母、数字、中划线、点号、空格,长度不能超过32个字符"), - FILE_SIZE_ERROR("A012014","文件大小不能超过5MB" ), - GENERATE_REPORT_ERROR("A012015","生成报告失败"), - ; + REPORT_NAME_PATTERN_ERROR("A012012", "报告名称格式错误,可包含中文、字母、数字、中划线、点号、空格,长度不能超过32个字符"), + REPORT_VERSION_PATTERN_ERROR("A012013", "报告版本号格式错误,可包含中文、字母、数字、中划线、点号、空格,长度不能超过32个字符"), + FILE_SIZE_ERROR("A012014", "文件大小不能超过5MB"), + GENERATE_REPORT_ERROR("A012015", "生成报告失败"), + FTP_CONNECTION_FAILED("A012016", "FTP连接失败,无法将二维码文件上传至装置"); private String code; private String message; diff --git a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java index d671d752..5cb31a40 100644 --- a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java @@ -726,11 +726,13 @@ public class PqReportServiceImpl extends ServiceImpl i data.set("password", devPsd); data.set("port", devPort); data.set("path", "ftp://" + devIp + devPath); - } else { + } else if (testFTPConnection(cloudUrl, gcDevPort, gcDevName, gcDevPsd)) { data.set("name", gcDevName); data.set("password", gcDevPsd); data.set("port", gcDevPort); data.set("path", "ftp://" + devIp + gcDevPath); + } else { + throw new BusinessException(ReportResponseEnum.FTP_CONNECTION_FAILED); } data.set("file", base64String); sendFileMsg.setData(data.toString());