MET、SOH普文件去重

This commit is contained in:
duwenyuan 2025-05-15 11:26:19 +08:00
parent 227466ab0a
commit eded0b3cfd
2 changed files with 64 additions and 46 deletions

View File

@ -22,6 +22,7 @@ import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 处理气象谱
@ -36,6 +37,7 @@ public class MetSpectrumServiceImpl extends ServiceImpl<GardsMetDataMapper, Gard
/**
* 保存气象谱数据
*
* @param struct
* @param fileName
* @return
@ -50,6 +52,12 @@ public class MetSpectrumServiceImpl extends ServiceImpl<GardsMetDataMapper, Gard
final GardsStations station = stationsService.check(struct.station_code, fileName);
List<GardsMetData> list = Lists.newArrayList();
if (struct.record_count > 0) {
String finalFileName = FileOperation.separatorConvert(fileName);
LambdaQueryWrapper<GardsMetData> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.select(GardsMetData::getMetId);
queryWrapper.eq(GardsMetData::getInputFileName, finalFileName);
GardsMetData metDataOne = this.getOne(queryWrapper, false);
if (Objects.isNull(metDataOne)) {
for (int i = 0; i < struct.record_count; i++) {
GardsMetData metData = new GardsMetData();
metData.setStationId(station.getStationId());
@ -72,6 +80,7 @@ public class MetSpectrumServiceImpl extends ServiceImpl<GardsMetDataMapper, Gard
});
}
}
}
return list;
}
}

View File

@ -20,8 +20,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 健康谱数据处理
@ -37,6 +39,7 @@ public class SOHSpectrumServiceImpl extends ServiceImpl<GardsSohDataMapper, Gard
/**
* 保存健康谱数据
*
* @param struct
* @param fileName
* @return
@ -55,6 +58,11 @@ public class SOHSpectrumServiceImpl extends ServiceImpl<GardsSohDataMapper, Gard
List<GardsSohData> list = Lists.newArrayList();
if (struct.af_record_count > 0) {
String finalFileName = FileOperation.separatorConvert(fileName);
LambdaQueryWrapper<GardsSohData> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(GardsSohData::getInputFileName, finalFileName);
GardsSohData sohDataOne = this.getOne(queryWrapper, false);
if (Objects.isNull(sohDataOne)) {
for (int i = 0; i < struct.af_record_count; i++) {
GardsSohData sohData = new GardsSohData();
sohData.setStationId(station.getStationId());
@ -74,6 +82,7 @@ public class SOHSpectrumServiceImpl extends ServiceImpl<GardsSohDataMapper, Gard
});
}
}
}
return list;
}
}