perf: 采集增加保存源路径

main
huangfeng 7 months ago
parent 58d933add8
commit ff10ba9763

@ -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;

@ -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;

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

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

Loading…
Cancel
Save