1.修改天气预报功能属性和存储策略

This commit is contained in:
panbaolin 2025-10-24 15:00:45 +08:00
parent c9072c0ae6
commit 035ba3b844
3 changed files with 31 additions and 40 deletions

View File

@ -8,23 +8,44 @@ public enum WeatherDataSourceEnum {
/**
* 盘古模型
*/
PANGU(1),
PANGU(1,"PANGU"),
/**
* Graphcast
*/
GRAPHCAST(2),
GRAPHCAST(2,"GRAPHCAST"),
/**
* 再分析数据
* CRA40
*/
RE_ANALYSIS(3);
CRA40(3,"CRA40"),
/**
* NCEP
*/
NCEP(4,"NCEP");
private Integer key;
WeatherDataSourceEnum(Integer key) {
private String value;
WeatherDataSourceEnum(Integer key,String value) {
this.key = key;
this.value = value;
}
public Integer getKey(){
return this.key;
}
public String getValue(){
return this.value;
}
public static WeatherDataSourceEnum getInfoByKey(int key) {
for (WeatherDataSourceEnum info : WeatherDataSourceEnum.values()) {
if (info.getKey() == key) {
return info;
}
}
return null;
}
}

View File

@ -34,11 +34,6 @@ public class SystemStorageProperties {
*/
private String graphcast;
/**
* 再分析数据存储路径
*/
private String reAnalysis;
/**
* WRF数据存储路径
*/
@ -48,29 +43,4 @@ public class SystemStorageProperties {
* CMAQ数据存储路径
*/
private String cmaqPath;
/**
* R项目所在路径
*/
private String rProject;
/**
* R项目输入目录
*/
private String rInput;
/**
* R项目输出目录
*/
private String rOutput;
/**
* srs 文件路径
*/
private String srsFilePath;
/**
* xe文件srs文件所在的目录
*/
private String xeGZFileDirSign;
}

View File

@ -325,9 +325,7 @@ public class WeatherDataServiceImpl extends ServiceImpl<WeatherDataMapper, Weath
queryResult.setFileSize(fileSize.doubleValue());
//把文件移入新路径
int year = utcDateTime.getYear();
int month = utcDateTime.getMonth().getValue();
int day = utcDateTime.getDayOfMonth();
String newFileDirPath = dataFile.getParentFile().getParent()+File.separator+year+File.separator+month+File.separator+day;
String newFileDirPath = dataFile.getParentFile().getParent()+File.separator+year+File.separator;
String newFilePath = newFileDirPath+File.separator+dataFile.getName();
FileUtil.mkdir(newFileDirPath);
File parentDir = dataFile.getParentFile();
@ -463,8 +461,10 @@ public class WeatherDataServiceImpl extends ServiceImpl<WeatherDataMapper, Weath
storagePath.append(this.systemStorageProperties.getPangu());
} else if (WeatherDataSourceEnum.GRAPHCAST.getKey().equals(dataSource)) {
storagePath.append(this.systemStorageProperties.getGraphcast());
}else if (WeatherDataSourceEnum.RE_ANALYSIS.getKey().equals(dataSource)) {
storagePath.append(this.systemStorageProperties.getReAnalysis());
}else if (WeatherDataSourceEnum.CRA40.getKey().equals(dataSource)) {
storagePath.append(this.systemStorageProperties.getCra40());
}else if (WeatherDataSourceEnum.NCEP.getKey().equals(dataSource)) {
storagePath.append(this.systemStorageProperties.getNcep());
}
storagePath.append(File.separator);
storagePath.append(fileName.substring(0,fileName.lastIndexOf(StringPool.DOT)));