From ff10ba9763ed89b6d93aca42bb4747b198d9539d Mon Sep 17 00:00:00 2001 From: huangfeng Date: Wed, 27 Nov 2024 13:45:32 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E9=87=87=E9=9B=86=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=BA=90=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/xydl/cac/entity/IedDlRecord.java | 6 +++++- src/main/java/com/xydl/cac/entity/RemoteDownload.java | 4 ++-- src/main/java/com/xydl/cac/iec/IEDCollectService.java | 4 +++- src/main/java/com/xydl/cac/iec/IecClient.java | 8 ++++---- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/xydl/cac/entity/IedDlRecord.java b/src/main/java/com/xydl/cac/entity/IedDlRecord.java index d2f3fe3..7e52967 100644 --- a/src/main/java/com/xydl/cac/entity/IedDlRecord.java +++ b/src/main/java/com/xydl/cac/entity/IedDlRecord.java @@ -30,7 +30,11 @@ public class IedDlRecord { @Column(name = "config_id") private Integer configId; - @ApiModelProperty("路径") + @ApiModelProperty("源路径") + @Column(name = "remote_path") + private String remotePath; + + @ApiModelProperty("本地路径") @Column(name = "path") private String path; diff --git a/src/main/java/com/xydl/cac/entity/RemoteDownload.java b/src/main/java/com/xydl/cac/entity/RemoteDownload.java index 42c04d4..11fbf44 100644 --- a/src/main/java/com/xydl/cac/entity/RemoteDownload.java +++ b/src/main/java/com/xydl/cac/entity/RemoteDownload.java @@ -30,11 +30,11 @@ public class RemoteDownload { @Column(name = "config_id") private Integer configId; - @ApiModelProperty("路径") + @ApiModelProperty("源路径") @Column(name = "remote_path") private String remotePath; - @ApiModelProperty("路径") + @ApiModelProperty("本地路径") @Column(name = "path") private String path; diff --git a/src/main/java/com/xydl/cac/iec/IEDCollectService.java b/src/main/java/com/xydl/cac/iec/IEDCollectService.java index f3068c2..f3eb428 100644 --- a/src/main/java/com/xydl/cac/iec/IEDCollectService.java +++ b/src/main/java/com/xydl/cac/iec/IEDCollectService.java @@ -185,13 +185,15 @@ public class IEDCollectService { IedDlRecord record = new IedDlRecord(); record.setConfigId(config.getId()); record.setFilename(filename); + record.setRemotePath(config.getPath() + filename); boolean exist = _dlRecordService.exist(record); if (!exist) { String localFilePath = localPath + "/" + filename; - iecClient.getFile(config.getPath(), filename, _bizConfig.getDatapath() + localFilePath, config.getTodel()); + iecClient.getFile(record.getRemotePath(), _bizConfig.getDatapath() + localFilePath, config.getTodel()); record.setPath(_bizConfig.getDataNginxPath() + localFilePath); record.setCreateTime(new Date()); _dlRecordService.add(record); + log.info("采集到" + record.getRemotePath()); } } } diff --git a/src/main/java/com/xydl/cac/iec/IecClient.java b/src/main/java/com/xydl/cac/iec/IecClient.java index 04cc63b..fad99d7 100644 --- a/src/main/java/com/xydl/cac/iec/IecClient.java +++ b/src/main/java/com/xydl/cac/iec/IecClient.java @@ -148,11 +148,11 @@ public class IecClient implements ClientEventListener { return list; } - public void getFile(String remotePath, String filename, String localPath, Integer todel) throws Exception { + public void getFile(String remotePath, String localPath, Integer todel) throws Exception { GetFileAction gfa = new GetFileAction(localPath); - clientAssociation.getFile(remotePath + filename, gfa); + clientAssociation.getFile(remotePath, gfa); if (todel != null && todel == Constants.TRUE) { - clientAssociation.deleteFile(remotePath + filename); + clientAssociation.deleteFile(remotePath); } } @@ -213,7 +213,7 @@ public class IecClient implements ClientEventListener { str = iecClient.getValue("OMDLMONT/SPDC1.MaxDsch.t", "MX"); System.out.println(str); List list = iecClient.listFile("/fdata"); - iecClient.getFile("/fdata/web/comtrade/1/18/6/", "20241021_113736_703_0_0.dat", "/eqmid/20241021_113736_703_0_0.dat", 1); + iecClient.getFile("/fdata/web/comtrade/1/18/6/20241021_113736_703_0_0.dat", "/eqmid/20241021_113736_703_0_0.dat", 1); } catch (Exception ex) { ex.printStackTrace();