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();