bug修改
This commit is contained in:
parent
ae748f6051
commit
af58b31fa6
|
|
@ -49,6 +49,11 @@ public class T1hDownloadProperties {
|
||||||
*/
|
*/
|
||||||
private String t1hPath;
|
private String t1hPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合并T1H的文件目录
|
||||||
|
*/
|
||||||
|
private String t1hNcPath;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* T1H下载Key
|
* T1H下载Key
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,8 @@ public class WeatherDataController {
|
||||||
@AutoLog(value = "气象预测-气象预览")
|
@AutoLog(value = "气象预测-气象预览")
|
||||||
@Operation(summary = "气象预测-气象预览")
|
@Operation(summary = "气象预测-气象预览")
|
||||||
@GetMapping(value = "getWeatherDataPreview")
|
@GetMapping(value = "getWeatherDataPreview")
|
||||||
public Result<?> getWeatherDataPreview(String weatherId,Integer weatherType, String timeBatch) {
|
public Result<?> getWeatherDataPreview(String weatherId,Integer weatherType) {
|
||||||
return Result.OK(weatherDataService.getWeatherDataPreview(weatherId, weatherType,timeBatch));
|
return Result.OK(weatherDataService.getWeatherDataPreview(weatherId, weatherType));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ public class DownloadT1hJob {
|
||||||
reformat(baseTime);
|
reformat(baseTime);
|
||||||
// 合并后删除原始文件
|
// 合并后删除原始文件
|
||||||
Arrays.stream(new File(getFullPath(t1hDownloadProperties.getT1hPath(), baseTime)).listFiles()).filter(File::isFile).forEach(File::delete);
|
Arrays.stream(new File(getFullPath(t1hDownloadProperties.getT1hPath(), baseTime)).listFiles()).filter(File::isFile).forEach(File::delete);
|
||||||
|
Arrays.stream(new File(getFullPath(t1hDownloadProperties.getT1hNcPath(), baseTime)).listFiles()).filter(File::isFile).forEach(File::delete);
|
||||||
// 更新气象文件信息
|
// 更新气象文件信息
|
||||||
saveWeatherData(baseTime);
|
saveWeatherData(baseTime);
|
||||||
log.info("T1H文件下载任务执行完成");
|
log.info("T1H文件下载任务执行完成");
|
||||||
|
|
@ -90,7 +91,7 @@ public class DownloadT1hJob {
|
||||||
t1hDownloadProperties.getPythonPath(),
|
t1hDownloadProperties.getPythonPath(),
|
||||||
getPythonScriptPath(t1hDownloadProperties.getMergeT1hPy()),
|
getPythonScriptPath(t1hDownloadProperties.getMergeT1hPy()),
|
||||||
"--indir", getFullPath(t1hDownloadProperties.getT1hPath(), baseTime),
|
"--indir", getFullPath(t1hDownloadProperties.getT1hPath(), baseTime),
|
||||||
"--output_dir", getFullPath(t1hDownloadProperties.getT1hPath(), baseTime),
|
"--output_dir", getFullPath(t1hDownloadProperties.getT1hNcPath(), baseTime),
|
||||||
"--variables", String.join(",", variables),
|
"--variables", String.join(",", variables),
|
||||||
"--forecast_times", String.join(",", forecastTimes),
|
"--forecast_times", String.join(",", forecastTimes),
|
||||||
"--base_date", baseTime
|
"--base_date", baseTime
|
||||||
|
|
@ -109,7 +110,7 @@ public class DownloadT1hJob {
|
||||||
getPythonScriptPath(t1hDownloadProperties.getReformatPy()),
|
getPythonScriptPath(t1hDownloadProperties.getReformatPy()),
|
||||||
"--ini_dir", getPythonScriptPath(t1hDownloadProperties.getScriptPath()),
|
"--ini_dir", getPythonScriptPath(t1hDownloadProperties.getScriptPath()),
|
||||||
"--output_dir", getFullPath(systemStorageProperties.getT1h(), baseTime),
|
"--output_dir", getFullPath(systemStorageProperties.getT1h(), baseTime),
|
||||||
"--cra_dir", getFullPath(t1hDownloadProperties.getT1hPath(), baseTime),
|
"--cra_dir", getFullPath(t1hDownloadProperties.getT1hNcPath(), baseTime),
|
||||||
"--start_date", getStartTime(),
|
"--start_date", getStartTime(),
|
||||||
"--end_date", getEndTime(),
|
"--end_date", getEndTime(),
|
||||||
"--var_table", getPythonScriptPath(t1hDownloadProperties.getLookupFileName())
|
"--var_table", getPythonScriptPath(t1hDownloadProperties.getLookupFileName())
|
||||||
|
|
@ -120,8 +121,8 @@ public class DownloadT1hJob {
|
||||||
|
|
||||||
private void saveWeatherData(String baseTime){
|
private void saveWeatherData(String baseTime){
|
||||||
//删除一个月前的文件
|
//删除一个月前的文件
|
||||||
LocalDateTime oneMonthAgo = LocalDateTime.now().minusMonths(1);
|
String timeBatch = LocalDateTime.now().minusMonths(1).format(DATE_FORMATTER) + "00";
|
||||||
List<WeatherData> weatherDatas = weatherDataService.list(new LambdaQueryWrapper<WeatherData>().lt(WeatherData::getDataStartTime, oneMonthAgo));
|
List<WeatherData> weatherDatas = weatherDataService.list(new LambdaQueryWrapper<WeatherData>().eq(WeatherData::getTimeBatch, timeBatch));
|
||||||
// 遍历删除文件
|
// 遍历删除文件
|
||||||
weatherDatas.forEach(data -> {
|
weatherDatas.forEach(data -> {
|
||||||
if (data.getFilePath() != null && !data.getFilePath().isEmpty()) {
|
if (data.getFilePath() != null && !data.getFilePath().isEmpty()) {
|
||||||
|
|
@ -132,7 +133,7 @@ public class DownloadT1hJob {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 删除数据库记录
|
// 删除数据库记录
|
||||||
weatherDataService.remove(new LambdaQueryWrapper<WeatherData>().eq(WeatherData::getDataSource, WeatherDataSourceEnum.T1H.getKey()));
|
weatherDataService.remove(new LambdaQueryWrapper<WeatherData>().eq(WeatherData::getTimeBatch, timeBatch));
|
||||||
// 读取目录文件信息
|
// 读取目录文件信息
|
||||||
List<WeatherData> weatherFileInfos = readFolderFiles(baseTime);
|
List<WeatherData> weatherFileInfos = readFolderFiles(baseTime);
|
||||||
//保存文件信息
|
//保存文件信息
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||||
public interface WeatherDataService extends IService<WeatherData> {
|
public interface WeatherDataService extends IService<WeatherData> {
|
||||||
|
|
||||||
WeatherResultVO getWeatherData(Integer dataType, Integer weatherType, String timeBatch, LocalDateTime startTime, int hour);
|
WeatherResultVO getWeatherData(Integer dataType, Integer weatherType, String timeBatch, LocalDateTime startTime, int hour);
|
||||||
WeatherResultVO getWeatherDataPreview(String weatherId, Integer weatherType, String timeBatch);
|
WeatherResultVO getWeatherDataPreview(String weatherId, Integer weatherType);
|
||||||
WindDataLineVO getDataLine(Integer dataType, String timeBatch, LocalDateTime startTime, LocalDateTime endTime, double longitude, double latitude);
|
WindDataLineVO getDataLine(Integer dataType, String timeBatch, LocalDateTime startTime, LocalDateTime endTime, double longitude, double latitude);
|
||||||
List<WindRoseData> getWindRose(Integer dataType, String timeBatch, LocalDateTime startTime, LocalDateTime endTime,double longitude, double latitude);
|
List<WindRoseData> getWindRose(Integer dataType, String timeBatch, LocalDateTime startTime, LocalDateTime endTime,double longitude, double latitude);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class WeatherDataServiceImpl extends ServiceImpl<WeatherDataMapper, Weath
|
||||||
* @return 天气数据列表
|
* @return 天气数据列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public WeatherResultVO getWeatherDataPreview(String weatherId, Integer weatherType, String timeBatch) {
|
public WeatherResultVO getWeatherDataPreview(String weatherId, Integer weatherType) {
|
||||||
Objects.requireNonNull(weatherId, "天气数据ID不能为空");
|
Objects.requireNonNull(weatherId, "天气数据ID不能为空");
|
||||||
WeatherData weatherData = this.baseMapper.selectById(weatherId);
|
WeatherData weatherData = this.baseMapper.selectById(weatherId);
|
||||||
Integer dataType = weatherData.getDataSource();
|
Integer dataType = weatherData.getDataSource();
|
||||||
|
|
@ -119,7 +119,7 @@ public class WeatherDataServiceImpl extends ServiceImpl<WeatherDataMapper, Weath
|
||||||
} else if (WeatherDataSourceEnum.FNL.getKey() == dataType){
|
} else if (WeatherDataSourceEnum.FNL.getKey() == dataType){
|
||||||
return processWeatherData(weatherType, null, targetTime, WeatherDataSourceEnum.FNL);
|
return processWeatherData(weatherType, null, targetTime, WeatherDataSourceEnum.FNL);
|
||||||
} else if (WeatherDataSourceEnum.T1H.getKey() == dataType){
|
} else if (WeatherDataSourceEnum.T1H.getKey() == dataType){
|
||||||
return processWeatherData(weatherType, timeBatch, targetTime, WeatherDataSourceEnum.T1H);
|
return processWeatherData(weatherType, null, targetTime, WeatherDataSourceEnum.T1H);
|
||||||
}
|
}
|
||||||
} catch (JeecgBootException e) {
|
} catch (JeecgBootException e) {
|
||||||
throw e;
|
throw e;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user