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
*/ */
GRAPHCAST(2), GRAPHCAST(2,"GRAPHCAST"),
/** /**
* 再分析数据 * CRA40
*/ */
RE_ANALYSIS(3); CRA40(3,"CRA40"),
/**
* NCEP
*/
NCEP(4,"NCEP");
private Integer key; private Integer key;
WeatherDataSourceEnum(Integer key) { private String value;
WeatherDataSourceEnum(Integer key,String value) {
this.key = key; this.key = key;
this.value = value;
} }
public Integer getKey(){ public Integer getKey(){
return this.key; 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 graphcast;
/**
* 再分析数据存储路径
*/
private String reAnalysis;
/** /**
* WRF数据存储路径 * WRF数据存储路径
*/ */
@ -48,29 +43,4 @@ public class SystemStorageProperties {
* CMAQ数据存储路径 * CMAQ数据存储路径
*/ */
private String cmaqPath; 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()); queryResult.setFileSize(fileSize.doubleValue());
//把文件移入新路径 //把文件移入新路径
int year = utcDateTime.getYear(); int year = utcDateTime.getYear();
int month = utcDateTime.getMonth().getValue(); String newFileDirPath = dataFile.getParentFile().getParent()+File.separator+year+File.separator;
int day = utcDateTime.getDayOfMonth();
String newFileDirPath = dataFile.getParentFile().getParent()+File.separator+year+File.separator+month+File.separator+day;
String newFilePath = newFileDirPath+File.separator+dataFile.getName(); String newFilePath = newFileDirPath+File.separator+dataFile.getName();
FileUtil.mkdir(newFileDirPath); FileUtil.mkdir(newFileDirPath);
File parentDir = dataFile.getParentFile(); File parentDir = dataFile.getParentFile();
@ -463,8 +461,10 @@ public class WeatherDataServiceImpl extends ServiceImpl<WeatherDataMapper, Weath
storagePath.append(this.systemStorageProperties.getPangu()); storagePath.append(this.systemStorageProperties.getPangu());
} else if (WeatherDataSourceEnum.GRAPHCAST.getKey().equals(dataSource)) { } else if (WeatherDataSourceEnum.GRAPHCAST.getKey().equals(dataSource)) {
storagePath.append(this.systemStorageProperties.getGraphcast()); storagePath.append(this.systemStorageProperties.getGraphcast());
}else if (WeatherDataSourceEnum.RE_ANALYSIS.getKey().equals(dataSource)) { }else if (WeatherDataSourceEnum.CRA40.getKey().equals(dataSource)) {
storagePath.append(this.systemStorageProperties.getReAnalysis()); storagePath.append(this.systemStorageProperties.getCra40());
}else if (WeatherDataSourceEnum.NCEP.getKey().equals(dataSource)) {
storagePath.append(this.systemStorageProperties.getNcep());
} }
storagePath.append(File.separator); storagePath.append(File.separator);
storagePath.append(fileName.substring(0,fileName.lastIndexOf(StringPool.DOT))); storagePath.append(fileName.substring(0,fileName.lastIndexOf(StringPool.DOT)));