SpectrumData新增字段SampleId,Status

新增方法根据文件路径查询对应的样品数据
散点图返回内容横纵坐标调换
This commit is contained in:
qiaoqinzheng 2023-07-26 14:29:51 +08:00
parent 2d4197ab2c
commit 97e65bfaa6
4 changed files with 64 additions and 11 deletions

View File

@ -36,4 +36,6 @@ public interface SpectrumAnalysisMapper {
GardsSampleData getSampleData(@Param(value = "sampleId") Integer sampleId);
GardsSampleData findSampleByFilePath(@Param(value = "filePath") String filePath);
}

View File

@ -189,4 +189,33 @@
</select>
<select id="findSampleByFilePath" resultType="org.jeecg.modules.base.entity.GardsSampleData">
SELECT
SITE_DET_CODE,
SAMPLE_ID,
STATION_ID,
DETECTOR_ID,
INPUT_FILE_NAME,
SAMPLE_TYPE,
DATA_TYPE,
GEOMETRY,
SPECTRAL_QUALIFIE,
TRANSMIT_DTG,
COLLECT_START,
COLLECT_STOP,
ACQUISITION_START,
ACQUISITION_STOP,
ACQUISITION_REAL_SEC,
ACQUISITION_LIVE_SEC,
QUANTITY,
STATUS,
MODDATE
FROM
ORIGINAL.GARDS_SAMPLE_DATA
<where>
INPUT_FILE_NAME = #{filePath}
</where>
</select>
</mapper>

View File

@ -194,32 +194,36 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
Map<String, Object> qcMap = new HashMap<>();
if(StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
String sampleFilePath = dbSpectrumFilePath.getSampleFilePath();
GardsSampleData sample = spectrumAnalysisMapper.findSampleByFilePath(sampleFilePath);
String pathName = sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
sampleMap = this.fenxi(pathName, fileName, xeDataList);
sampleMap = this.fenxi(pathName, fileName, xeDataList, sample.getSampleId(), sample.getStatus());
resultMap.put("sample",sampleMap);
}
if(StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())){
String gasBgFilePath = dbSpectrumFilePath.getGasBgFilePath();
GardsSampleData gasBg = spectrumAnalysisMapper.findSampleByFilePath(gasBgFilePath);
String pathName = gasBgFilePath.substring(0, gasBgFilePath.lastIndexOf(StringPool.SLASH));
String fileName = gasBgFilePath.substring(gasBgFilePath.lastIndexOf(StringPool.SLASH)+1);
gasBgMap = this.fenxi(pathName, fileName, xeDataList);
gasBgMap = this.fenxi(pathName, fileName, xeDataList, gasBg.getSampleId(), gasBg.getStatus());
resultMap.put("gasBg",gasBgMap);
}
if(StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())){
String detBgFilePath = dbSpectrumFilePath.getDetBgFilePath();
GardsSampleData detBg = spectrumAnalysisMapper.findSampleByFilePath(detBgFilePath);
String pathName = detBgFilePath.substring(0, detBgFilePath.lastIndexOf(StringPool.SLASH));
String fileName = detBgFilePath.substring(detBgFilePath.lastIndexOf(StringPool.SLASH)+1);
detBgMap = this.fenxi(pathName, fileName, xeDataList);
detBgMap = this.fenxi(pathName, fileName, xeDataList, detBg.getSampleId(), detBg.getStatus());
resultMap.put("detBg",detBgMap);
}
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy-MM-dd HH:mm:ss");
String dbQcFilePath = spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr);
dbSpectrumFilePath.setQcFilePath(dbQcFilePath);
if(StringUtils.isNotBlank(dbQcFilePath)){
GardsSampleData qc = spectrumAnalysisMapper.findSampleByFilePath(dbQcFilePath);
String pathName = dbQcFilePath.substring(0, dbQcFilePath.lastIndexOf(StringPool.SLASH));
String fileName = dbQcFilePath.substring(dbQcFilePath.lastIndexOf(StringPool.SLASH)+1);
qcMap = this.fenxi(pathName, fileName, xeDataList);
qcMap = this.fenxi(pathName, fileName, xeDataList, qc.getSampleId(), qc.getStatus());
resultMap.put("qc",qcMap);
}
phdFileUtil.getLightColor(sampleMap,gasBgMap,detBgMap,qcMap);
@ -229,7 +233,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
return result;
}
private Map<String, Object> fenxi(String pathName, String fileName, List<GardsXeResults> xeDataList) {
private Map<String, Object> fenxi(String pathName, String fileName, List<GardsXeResults> xeDataList, Integer sampleId, String status) {
Map<String, Object> map = new HashMap<>();
FTPClient ftpClient = ftpUtil.LoginFTP();
if (Objects.isNull(ftpClient)){
@ -253,7 +257,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
File file = File.createTempFile("tmp", null);
//将ftp文件的输入流复制给临时文件
FileUtils.copyInputStreamToFile(inputStream, file);
map = phdFileUtil.getSourceData(file.getAbsolutePath(), fileName, xeDataList);
map = phdFileUtil.getSourceData(file.getAbsolutePath(), fileName, xeDataList, sampleId, status);
if (Objects.nonNull(inputStream)){
inputStream.close();
}
@ -1199,8 +1203,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
long count = hCounts.get(index.intValue());
if (count>0) {
HistogramData histogramData = new HistogramData();
histogramData.setG(row);
histogramData.setB(column);
histogramData.setB(row);
histogramData.setG(column);
histogramDataList.add(histogramData);
}
counts.add(count);
@ -1305,12 +1309,30 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
FileUtils.copyInputStreamToFile(inputStream, file);
//读取文件信息
EnergySpectrumStruct struct = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//Acquisition
String acquisitionStart = struct.acquisition_start_date + " " + struct.acquisition_start_time;
String acquisitionRealTime = String.valueOf(struct.acquisition_real_time);
String acquisitionLiveTime = String.valueOf(struct.acquisition_live_time);
//Gamma Spectrum: Sample
//蓝色
List<Long> gCounts = struct.g_counts;
List<Double> chanelEnergy = new LinkedList<>();
List<Double> gCentroidChannel = struct.g_centroid_channel;
List<Double> gEnergy = struct.g_energy;
List<Double> fittingPara = EnergySpectrumHandler.GetFileFittingPara(gCentroidChannel,gEnergy);
for (int i=0; i<struct.num_g_channel; i++){
List<Double> channel = new LinkedList<>();
channel.add(Double.valueOf(i));
List<Double> energy = EnergySpectrumHandler.GetFileFittingData(channel, fittingPara);
if(CollectionUtils.isNotEmpty(energy)) {
chanelEnergy.add(energy.get(0));
}
}
//Beta Spectrum: Sample
//蓝色
List<Long> bCounts = struct.b_counts;
if (Objects.nonNull(inputStream)){
inputStream.close();

View File

@ -123,8 +123,8 @@ public class ReadLineUtil {
for (int j=0;j< values.size(); j++) {
if (!"0".equals(values.get(j))){
HistogramData histogramData = new HistogramData();
histogramData.setB(i);
histogramData.setG(j);
histogramData.setG(i);
histogramData.setB(j);
histogramData.setC(Integer.valueOf(values.get(j)));
result.add(histogramData);
}