fix:接收到GPS谱后 根据最新经纬度更新台站数据

This commit is contained in:
xiaoguangbin 2024-11-06 10:14:58 +08:00
parent 3c82017aed
commit 1ffb984286
2 changed files with 24 additions and 0 deletions

View File

@ -1,11 +1,13 @@
package org.jeecg.modules.spectrum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.apache.commons.io.FileUtils;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.ErrorLogManager;
import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.modules.base.entity.original.GardsGPSData;
import org.jeecg.modules.base.enums.DataType;
import org.jeecg.modules.base.enums.SampleFileHeader;
@ -25,6 +27,7 @@ import java.time.LocalDate;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;
public class GPSSpectrum extends AbstractSpectrumHandler{
@ -95,6 +98,8 @@ public class GPSSpectrum extends AbstractSpectrumHandler{
super.saveFileToSavefile();
//结构体数据入库
this.handlerOriginalData();
// 更新台站经纬度
this.handlerStationData();
//把流程日志保存到日志目录
this.saveLogToLogDir();
//若本次文件来自于undel目录解析成功则删除
@ -249,6 +254,23 @@ public class GPSSpectrum extends AbstractSpectrumHandler{
this.endIntoDatabaseTime = new Date();
}
/**
* 更新台站经纬度
* @throws Exception
*/
protected void handlerStationData() throws Exception {
LambdaQueryWrapper<GardsStations> gardsStationsQuery = new LambdaQueryWrapper<>();
gardsStationsQuery.select(GardsStations::getStationId);
gardsStationsQuery.eq(GardsStations::getStationCode,this.sourceData.stationCode);
GardsStations stations = spectrumServiceQuotes.getGardsStationsService().getOne(gardsStationsQuery);
if (Objects.nonNull(stations)) {
// 使用最新位置更新台站经纬度
stations.setLat(Double.valueOf(this.sourceData.latList.get(this.sourceData.latList.size() -1)));
stations.setLon(Double.valueOf(this.sourceData.lonList.get(this.sourceData.latList.size() -1)));
spectrumServiceQuotes.getGardsStationsService().updateById(stations);
}
}
/**
* 把流程日志保存到日志目录
*/

View File

@ -92,6 +92,8 @@ public class SpectrumServiceQuotes {
private final IGardsGPSDataService gardsGPSDataService;
private final GardsStationsService gardsStationsService;
private final SelfUtil selfStationUtil;
/* 自动处理库_ROI相关类引用 */