web模块加载数据慢问题修改

去除web模块无效引用包
This commit is contained in:
qiaoqinzheng 2023-11-20 14:01:04 +08:00
parent 8c0466ba1a
commit 565871aea5
13 changed files with 842 additions and 276 deletions

View File

@ -1,20 +1,14 @@
package org.jeecg.common.util;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.Prompt;
import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.modules.entity.data.HistogramData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

View File

@ -8,10 +8,10 @@ import java.util.List;
@Data
public class BetaSpectrum implements Serializable {
private Integer numberBChannels;
private Long numberBChannels;
private Integer energySpan;
private Long energySpan;
private List<Integer> bSpectrumSubBlock;
private List<Long> bSpectrumSubBlock;
}

View File

@ -8,10 +8,10 @@ import java.util.List;
@Data
public class GammaSpectrum implements Serializable {
private Integer numberGChannels;
private Long numberGChannels;
private Integer energySpan;
private Long energySpan;
private List<Integer> gSpectrumSubBlock;
private List<Long> gSpectrumSubBlock;
}

View File

@ -8,13 +8,13 @@ import java.util.List;
@Data
public class Histogram implements Serializable {
private Integer BChannels;
private Long BChannels;
private Integer BEnergySpan;
private Long BEnergySpan;
private Integer GChannels;
private Long GChannels;
private Integer GEnergySpan;
private Long GEnergySpan;
private List<HistogramData> histogramSubBlock;

View File

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.entity.GardsSampleDataWeb;
import org.jeecg.modules.entity.vo.SpectrumFileRecord;

View File

@ -2,9 +2,6 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.postgre.SysEmailLog;
import org.jeecg.modules.entity.GardsAlertDataWeb;
import java.util.Date;
public interface SysEmailLogStatMapper extends BaseMapper<SysEmailLog> {

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.native_jni;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
/**
* 能谱处理本地类
*/
public class EnergySpectrumHandler {
/**
* 获取能谱原始数据
* @param path 能谱文件路径
* @return 能谱原始数据
*/
public static native EnergySpectrumStruct getSourceData(String path);
}

View File

@ -0,0 +1,555 @@
package org.jeecg.modules.native_jni.struct;
import lombok.Data;
import java.util.List;
/**
* 能谱结构体字段信息
*/
@Data
public class EnergySpectrumStruct {
/************************* Infomations ******************/
/**
* 消息类型
*/
public String msg_type;
/**
* 消息id
*/
public String msg_id;
/**
* 数据类型
*/
public String data_type;
/************************* Header Black ******************/
/**
* designator
*/
public String designator;
/**
* site code
*/
public String site_code;
/**
* detector code
*/
public String detector_code;
/**
* system type: P for particulate; B for gas with 3-D β - γ coincidence detection; and
*/
public String system_type;
/**
* sample geometry
*/
public String sample_geometry;
/**
* spectrum qualifier: preliminary ( PREL )or full ( FULL)
*/
public String spectrum_quantity;
/**
* sample reference identification
*/
public String sample_ref_id;
/**
* measurement identification
*/
public String measurement_id;
/**
* detector background measurement identification
*/
public String detector_bk_measurement_id;
/**
* gas background measurement identification (memory effect)
*/
public String gas_bk_measurement_id;
/**
* transmit date (yyyy / mm / dd)
*/
public String transmit_date;
/**
* transmit time (hh : mm : ss . s)
*/
public String transmit_time;
/************************* Sample ******************/
public double dimension_1;
public double dimension_2;
/************************* Comment ******************/
public String comment;
/************************* Acquisition Block ******************/
/**
* acquisition start date (yyyy / mm / dd)
*/
public String acquisition_start_date;
/**
* acquisition start time (hh : mm : ss . s)
*/
public String acquisition_start_time;
/**
* acquisition real time (s)
*/
public double acquisition_real_time;
/**
* acquisition live time (s)
*/
public double acquisition_live_time;
/************************* Collection Block ******************/
/**
* collection start date (yyyy / mm / dd)
*/
public String collection_start_date;
/**
* collection start time (hh : mm : ss . s)
*/
public String collection_start_time;
/**
* collection stop date (yyyy / mm / dd)
*/
public String collection_stop_date;
/**
* collection stop time (hh : mm : ss . s)
*/
public String collection_stop_time;
/**
* total air volume sampled (standard cubic meters [scm])
*/
public double air_volume;
/************************* Processing Block ******************/
/**
* sample volume of Xe (cm 3 )
*/
public double sample_volume_of_Xe;
/**
* uncertainty (cm 3 )
*/
public double uncertainty_1;
/**
* Xe collection yield (Xe gas in sample/total Xe gas sampled)
*/
public double Xe_collection_yield;
/**
* uncertainty (Xe gas in sample/total Xe gas sampled)
*/
public double uncertainty_2;
/**
* archive bottle identification
*/
public String archive_bottle_id;
/************************* Calibration Block ******************/
/**
* date of last calibration (yyyy / mm / dd)
*/
public String date_calibration;
/**
* time of last calibration (hh : mm : ss)
*/
public String time_calibration;
/************************* g_Energy Block ******************/
/**
* γ -energy (keV)
*/
public List<Double> g_energy;
/**
* centroid channel
*/
public List<Double> g_centroid_channel;
/**
* uncertainty (channels)
*/
public List<Double> g_uncertainty;
public int g_record_count;
/************************* b_Energy Block ******************/
/**
* electron energy (keV)
*/
public List<Double> b_electron_energy;
/**
* decay mode descriptor: B for β-particle, C for conversion electron (CE)
*/
public List<String> b_decay_mode;
/**
* maximum channel of β-particle distribution or centroid channel of CE (channels)
*/
public List<Double> b_channel;
/**
* uncertainty (channels)
*/
public List<Double> b_uncertainty;
public int b_record_count;
/************************* g_Resolution Block ******************/
/**
* γ -energy (keV)
*/
public List<Double> g_r_energy;
/**
* FWHM (keV)
*/
public List<Double> g_r_FWHM;
/**
* uncertainty (keV)
*/
public List<Double> g_r_uncertainty;
public int g_r_record_count;
/************************* b_Resolution Block ******************/
/**
* electron energy (keV)
*/
public List<Double> b_r_electron_energy;
/**
* FWHM (keV)
*/
public List<Double> b_r_FWHM;
/**
* uncertainty (keV)
*/
public List<Double> b_r_uncertainty;
public int b_r_record_count;
/************************* g_Efficiency Block ******************/
/**
* γ -energy (keV)
*/
public List<Double> g_e_energy;
/**
* efficiency (counts in peak/photon emitted)
*/
public List<Double> g_e_efficiency;
/**
* uncertainty (counts in peak/photon emitted)
*/
public List<Double> g_e_uncertainty;
public int g_e_record_count;
/************************* ROI_Limits Block ******************/
/**
* ROI number
*/
public List<String> ROI_number;
/**
* 2-D ROI β-range start, x 1 (keV)
*/
public List<Double> POI_B_x1;
/**
* 2-D ROI β-range stop, x 2 (keV)
*/
public List<Double> POI_B_x2;
/**
* 2-D ROI γ-range start, y 1 (keV)
*/
public List<Double> POI_G_y1;
/**
* 2-D ROI γ-range stop, y 2 (keV)
*/
public List<Double> POI_G_y2;
public int roi_record_count;
/************************* b-gEfficiency Block ******************/
/**
* nuclide name
*/
public List<String> bg_nuclide_name;
/**
* ROI number
*/
public List<Double> bg_ROI_number;
/**
* β-γ coincidence efficiency (counts in ROI/β-γ pair emitted)
*/
public List<Double> bg_efficiency;
/**
* uncertainty (counts in ROI/β-γ pair emitted)
*/
public List<Double> bg_uncertainty;
public int bg_record_count;
/************************* Ratios Block ******************/
/**
* ratio identifier
*/
public List<String> ratio_id;
/**
* ROI number for the higher γ -energy ROI
*/
public List<String> ROI_num_highter_G_energy_ROI;
/**
* ROI number for the lower γ -energy ROI
*/
public List<String> ROI_num_lower_G_energy_ROI;
/**
* Q_DECLARE_METATYPE(RMSSOHData::HeaderBlock)count ratio(counts in higher γ -energy ROI/counts in lower γ -energy ROI)
*/
public List<Double> count_ratio;
/**
* count ratio uncertainty (percent)
*/
public List<Double> count_ratio_uncertainty;
public int ratio_record_count;
/************************* g_Spectrum Block ******************/
/**
* number of γ channels
*/
public long num_g_channel;
/**
* γ-energy span (keV)
*/
public long g_energy_span;
/**
* begin of channels
*/
public long g_begin_channel;
/**
* count at channel
*/
public List<Long> g_counts;
/************************* b_Spectrum Block ******************/
/**
* number of β -channels
*/
public long num_b_channel;
/**
* β -energy span (keV)
*/
public long b_energy_span;
/**
* begin of channels
*/
public long b_begin_channel;
/**
* counts at channels
*/
public List<Long> b_counts;
/************************* Histogram Block ******************/
/**
* β-channels
*/
public long b_channels;
/**
* γ-channels
*/
public long g_channels;
/**
* β-energy span
*/
public long b_h_energy_span;
/**
* γ-energy span
*/
public long g_h_energy_span;
/**
* counts at channels
*/
public List<Long> h_counts;
/************************* Certificate_Block ******************/
/**
* total source activity (Bq)
*/
public double total_source_activity;
/**
* assay date (yyyy / mm / dd)
*/
public String assay_date;
/**
* assay time (hh : mm : ss)
*/
public String assay_time;
/**
* units of activity: B, b for Bq or [blank]; if nothing, then B is assigned
*/
public String units_activity;
/**
* nuclide name
*/
public List<String> nuclide_name;
/**
* half-life in seconds, hours, days, or years
*/
public List<String> half_life_time;
/**
* time unit(Y, D, H, S)
*/
public List<String> time_unit;
/**
* activity of nuclide at time of assay
*/
public List<Double> activity_nuclide_time_assay;
/**
* uncertainty (%)
*/
public List<Double> uncertainty;
/**
* γ-energy (keV)
*/
public List<Double> cer_g_energy;
/**
* γ-intensity (percent)
*/
public List<Double> g_intensity;
/**
* electron decay mode descriptor: B for β particle or C for conversion electron (CE), 0 for none (that is, γ-only source)
*/
public List<String> electron_decay_mode;
/**
* maximum β-particle energy or CE energy (keV)
*/
public List<Double> maximum_energy;
/**
* intensity of β-particle (percent)
*/
public List<Double> intensity_b_particle;
public int record_count;
/************************* Totaleff Block ******************/
/**
* γ-energy (keV)
*/
public List<Double> t_g_energy;
/**
* total efficiency (counts/photon emitted)
*/
public List<Double> total_efficiency;
/**
* uncertainty (counts/photon emitted)
*/
public List<Double> t_uncertainty;
public int t_record_count;
public EnergySpectrumStruct() {
super();
}
@Override
public String toString() {
return "EnergySpectrumStruct{" +
"msg_type='" + msg_type + '\'' +
", msg_id='" + msg_id + '\'' +
", data_type='" + data_type + '\'' +
", designator='" + designator + '\'' +
", site_code='" + site_code + '\'' +
", detector_code='" + detector_code + '\'' +
", system_type='" + system_type + '\'' +
", sample_geometry='" + sample_geometry + '\'' +
", spectrum_quantity='" + spectrum_quantity + '\'' +
", sample_ref_id='" + sample_ref_id + '\'' +
", measurement_id='" + measurement_id + '\'' +
", detector_bk_measurement_id='" + detector_bk_measurement_id + '\'' +
", gas_bk_measurement_id='" + gas_bk_measurement_id + '\'' +
", transmit_date='" + transmit_date + '\'' +
", transmit_time='" + transmit_time + '\'' +
", comment='" + comment + '\'' +
", acquisition_start_date='" + acquisition_start_date + '\'' +
", acquisition_start_time='" + acquisition_start_time + '\'' +
", acquisition_real_time=" + acquisition_real_time +
", acquisition_live_time=" + acquisition_live_time +
", collection_start_date='" + collection_start_date + '\'' +
", collection_start_time='" + collection_start_time + '\'' +
", collection_stop_date='" + collection_stop_date + '\'' +
", collection_stop_time='" + collection_stop_time + '\'' +
", air_volume=" + air_volume +
", sample_volume_of_Xe=" + sample_volume_of_Xe +
", uncertainty_1=" + uncertainty_1 +
", Xe_collection_yield=" + Xe_collection_yield +
", uncertainty_2=" + uncertainty_2 +
", archive_bottle_id='" + archive_bottle_id + '\'' +
", date_calibration='" + date_calibration + '\'' +
", time_calibration='" + time_calibration + '\'' +
", g_energy=" + g_energy +
", g_centroid_channel=" + g_centroid_channel +
", g_uncertainty=" + g_uncertainty +
", g_record_count=" + g_record_count +
", b_electron_energy=" + b_electron_energy +
", b_decay_mode=" + b_decay_mode +
", b_channel=" + b_channel +
", b_uncertainty=" + b_uncertainty +
", b_record_count=" + b_record_count +
", g_r_energy=" + g_r_energy +
", g_r_FWHM=" + g_r_FWHM +
", g_r_uncertainty=" + g_r_uncertainty +
", g_r_record_count=" + g_r_record_count +
", b_r_electron_energy=" + b_r_electron_energy +
", b_r_FWHM=" + b_r_FWHM +
", b_r_uncertainty=" + b_r_uncertainty +
", b_r_record_count=" + b_r_record_count +
", g_e_energy=" + g_e_energy +
", g_e_efficiency=" + g_e_efficiency +
", g_e_uncertainty=" + g_e_uncertainty +
", g_e_record_count=" + g_e_record_count +
", ROI_number=" + ROI_number +
", POI_B_x1=" + POI_B_x1 +
", POI_B_x2=" + POI_B_x2 +
", POI_G_y1=" + POI_G_y1 +
", POI_G_y2=" + POI_G_y2 +
", roi_record_count=" + roi_record_count +
", bg_nuclide_name=" + bg_nuclide_name +
", bg_ROI_number=" + bg_ROI_number +
", bg_efficiency=" + bg_efficiency +
", bg_uncertainty=" + bg_uncertainty +
", bg_record_count=" + bg_record_count +
", ratio_id=" + ratio_id +
", ROI_num_highter_G_energy_ROI=" + ROI_num_highter_G_energy_ROI +
", ROI_num_lower_G_energy_ROI=" + ROI_num_lower_G_energy_ROI +
", count_ratio=" + count_ratio +
", count_ratio_uncertainty=" + count_ratio_uncertainty +
", ratio_record_count=" + ratio_record_count +
", num_g_channel=" + num_g_channel +
", g_energy_span=" + g_energy_span +
", g_begin_channel=" + g_begin_channel +
", g_counts=" + g_counts +
", num_b_channel=" + num_b_channel +
", b_energy_span=" + b_energy_span +
", b_begin_channel=" + b_begin_channel +
", b_counts=" + b_counts +
", b_channels=" + b_channels +
", g_channels=" + g_channels +
", b_h_energy_span=" + b_h_energy_span +
", g_h_energy_span=" + g_h_energy_span +
", h_counts=" + h_counts +
", total_source_activity=" + total_source_activity +
", assay_date='" + assay_date + '\'' +
", assay_time='" + assay_time + '\'' +
", units_activity='" + units_activity + '\'' +
", nuclide_name=" + nuclide_name +
", half_life_time=" + half_life_time +
", time_unit=" + time_unit +
", activity_nuclide_time_assay=" + activity_nuclide_time_assay +
", uncertainty=" + uncertainty +
", cer_g_energy=" + cer_g_energy +
", g_intensity=" + g_intensity +
", electron_decay_mode=" + electron_decay_mode +
", maximum_energy=" + maximum_energy +
", intensity_b_particle=" + intensity_b_particle +
", record_count=" + record_count +
'}';
}
public static void main(String[] args) {
EnergySpectrumStruct s = new EnergySpectrumStruct();
System.out.println(s);
System.out.println(s.gas_bk_measurement_id);
}
}

View File

@ -1,7 +1,6 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.swagger.models.auth.In;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.GardsSampleDataWeb;

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.postgre.SysEmailLog;
import java.util.Date;
public interface ISysEmailLogStatService extends IService<SysEmailLog> {

View File

@ -18,6 +18,7 @@ import org.jeecg.modules.service.IGardsMetDataService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;

View File

@ -20,12 +20,15 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.util.*;
import org.jeecg.modules.base.enums.SampleFileHeader;
import org.jeecg.modules.base.entity.original.*;
import org.jeecg.modules.base.entity.original.GardsSampleAux;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.original.GardsSampleDescription;
import org.jeecg.modules.entity.GardsSampleDataWeb;
import org.jeecg.modules.entity.data.*;
import org.jeecg.modules.entity.vo.SpectrumFileRecord;
import org.jeecg.modules.mapper.*;
import org.jeecg.modules.native_jni.EnergySpectrumHandler;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecg.modules.service.IGardsSampleDataWebService;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
@ -37,7 +40,6 @@ import java.io.*;
import java.net.URLEncoder;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
import static org.jeecg.modules.base.enums.PageType.*;
@ -138,32 +140,43 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
public Result findGeneratedReport(Integer sampleId) {
Result result = new Result();
Report report = new Report();
//查询info
this.findInfo(sampleId, report);
//查询G_energy
this.findGEnergy(sampleId, report);
//查询B_energy
this.findBEnergy(sampleId, report);
//查询G_Resolution
this.findGResolution(sampleId, report);
//查询B_Resolution
this.findBResolution(sampleId, report);
//查询G_Efficiency
this.findGEfficiency(sampleId, report);
//查询B_gEfficiency
this.findBgEfficiency(sampleId, report);
//查询ROI
this.findRoiLimits(sampleId, report);
//查询RATIOS
this.findRatios(sampleId, report);
//查询 GAMMA SPECTRUM
this.findGSpectrum(sampleId, report);
//查询 BETA SPECTRUM
this.findBSpectrum(sampleId, report);
//查询Histogram
this.findHistogram(sampleId, report);
//查询Certificate
this.findCertificate(sampleId, report);
File file = null;
//根据sampleId查询对应的文件路径
GardsSampleDataWeb sampleData = getOneSample(sampleId);
String filePath = sampleData.getInputFileName();
if (StringUtils.isNotBlank(filePath)) {
file = ftpUtil.downloadFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath, "betaGamma");
if (Objects.nonNull(file)) {
System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//查询info
this.findInfo(sampleId, report);
//查询G_energy
this.findGEnergy(sourceData, report);
//查询B_energy
this.findBEnergy(sourceData, report);
//查询G_Resolution
this.findGResolution(sourceData, report);
//查询B_Resolution
this.findBResolution(sourceData, report);
//查询G_Efficiency
this.findGEfficiency(sourceData, report);
//查询B_gEfficiency
this.findBgEfficiency(sourceData, report);
//查询ROI
this.findRoiLimits(sourceData, report);
//查询RATIOS
this.findRatios(sourceData, report);
//查询 GAMMA SPECTRUM
this.findGSpectrum(sourceData, report);
//查询 BETA SPECTRUM
this.findBSpectrum(sourceData, report);
//查询Histogram
this.findHistogram(sourceData, report);
//查询Certificate
this.findCertificate(sourceData, report);
}
}
result.setSuccess(true);
result.setResult(report);
return result;
@ -404,328 +417,319 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
report.setCalibrationBlock(calibration);
}
private void findGEnergy(Integer sampleId, Report report) {
private void findGEnergy(EnergySpectrumStruct sourceData, Report report) {
List<GEnergy> gEnergySubBlock = null;
LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
// LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
// List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sourceData.g_energy) && CollectionUtils.isNotEmpty(sourceData.g_centroid_channel) && CollectionUtils.isNotEmpty(sourceData.g_uncertainty)){
gEnergySubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
for (int i=0; i<sourceData.g_energy.size(); i++) {
GEnergy gEnergy = new GEnergy();
if (Objects.nonNull(orig.getYValue()) && Objects.nonNull(orig.getXValue()) && Objects.nonNull(orig.getUncYValue())){
gEnergy.setEnergy(orig.getYValue());
gEnergy.setCentroid(orig.getXValue());
gEnergy.setUncertainty(orig.getUncYValue());
gEnergySubBlock.add(gEnergy);
}
gEnergy.setEnergy(sourceData.g_energy.get(i));
gEnergy.setCentroid(sourceData.g_centroid_channel.get(i));
gEnergy.setUncertainty(sourceData.g_uncertainty.get(i));
gEnergySubBlock.add(gEnergy);
}
}
report.setGEnergyBlock(gEnergySubBlock);
}
private void findBEnergy(Integer sampleId, Report report) {
private void findBEnergy(EnergySpectrumStruct sourceData, Report report) {
List<BEnergy> bEnergySubBlock = null;
LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B");
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
// LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B");
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
// List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("energy")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sourceData.b_electron_energy) && CollectionUtils.isNotEmpty(sourceData.b_channel) && CollectionUtils.isNotEmpty(sourceData.b_uncertainty) && CollectionUtils.isNotEmpty(sourceData.b_decay_mode)){
bEnergySubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
for (int i=0; i<sourceData.b_electron_energy.size(); i++) {
BEnergy bEnergy = new BEnergy();
if (Objects.nonNull(orig.getYValue()) && Objects.nonNull(orig.getXValue()) && Objects.nonNull(orig.getUncYValue()) && Objects.nonNull(orig.getDecayMode())){
bEnergy.setElectronEnergy(orig.getYValue());
bEnergy.setMaximumChannel(orig.getXValue());
bEnergy.setUncertainty(orig.getUncYValue());
bEnergy.setDecayModeDescriptor(orig.getDecayMode());
bEnergySubBlock.add(bEnergy);
}
bEnergy.setElectronEnergy(sourceData.b_electron_energy.get(i));
bEnergy.setMaximumChannel(sourceData.b_channel.get(i));
bEnergy.setUncertainty(sourceData.b_uncertainty.get(i));
bEnergy.setDecayModeDescriptor(sourceData.b_decay_mode.get(i));
bEnergySubBlock.add(bEnergy);
}
}
report.setBEnergyBlock(bEnergySubBlock);
}
private void findGResolution(Integer sampleId, Report report) {
private void findGResolution(EnergySpectrumStruct sourceData, Report report) {
List<GResolution> gResolutionSubBlock = null;
LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
// LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
// List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sourceData.g_r_energy) && CollectionUtils.isNotEmpty(sourceData.g_r_FWHM) && CollectionUtils.isNotEmpty(sourceData.g_r_uncertainty)){
gResolutionSubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
for (int i=0; i<sourceData.g_r_energy.size(); i++) {
GResolution gResolution = new GResolution();
if (Objects.nonNull(orig.getYValue()) && Objects.nonNull(orig.getXValue()) && Objects.nonNull(orig.getUncYValue())){
gResolution.setEnergy(orig.getXValue());
gResolution.setFWHM(orig.getYValue());
gResolution.setUncertainty(orig.getUncYValue());
gResolutionSubBlock.add(gResolution);
}
gResolution.setEnergy(sourceData.g_r_energy.get(i));
gResolution.setFWHM(sourceData.g_r_FWHM.get(i));
gResolution.setUncertainty(sourceData.g_r_uncertainty.get(i));
gResolutionSubBlock.add(gResolution);
}
}
report.setGResolutionBlock(gResolutionSubBlock);
}
private void findBResolution(Integer sampleId, Report report) {
private void findBResolution(EnergySpectrumStruct sourceData, Report report) {
List<BResolution> bResolutionSubBlock = null;
LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B");
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
// LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "B");
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
// List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("Resolution")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sourceData.b_r_electron_energy) && CollectionUtils.isNotEmpty(sourceData.b_r_FWHM) && CollectionUtils.isNotEmpty(sourceData.b_r_uncertainty)){
bResolutionSubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
for (int i=0; i<sourceData.b_r_electron_energy.size(); i++) {
BResolution bResolution = new BResolution();
if (Objects.nonNull(orig.getYValue()) && Objects.nonNull(orig.getXValue()) && Objects.nonNull(orig.getUncYValue())){
bResolution.setElectronEnergy(orig.getXValue());
bResolution.setFWHM(orig.getYValue());
bResolution.setUncertainty(orig.getUncYValue());
bResolutionSubBlock.add(bResolution);
}
bResolution.setElectronEnergy(sourceData.b_r_electron_energy.get(i));
bResolution.setFWHM(sourceData.b_r_FWHM.get(i));
bResolution.setUncertainty(sourceData.b_r_uncertainty.get(i));
bResolutionSubBlock.add(bResolution);
}
}
report.setBResolutionBlock(bResolutionSubBlock);
}
private void findGEfficiency(Integer sampleId, Report report) {
private void findGEfficiency(EnergySpectrumStruct sourceData, Report report) {
List<GEfficiency> gEfficiencySubBlock = null;
LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("efficiency")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(gardsCalibrationPairsOrigs)){
// LambdaQueryWrapper<GardsCalibrationPairsOrig> calibrationPairsOrigQueryWrapper = new LambdaQueryWrapper<>();
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleType, "G");
// calibrationPairsOrigQueryWrapper.eq(GardsCalibrationPairsOrig::getSampleId, sampleId);
// calibrationPairsOrigQueryWrapper.orderByAsc(GardsCalibrationPairsOrig::getIdCalPoint);
// List<GardsCalibrationPairsOrig> gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigMapper.selectList(calibrationPairsOrigQueryWrapper);
// gardsCalibrationPairsOrigs = gardsCalibrationPairsOrigs.stream().filter(item->item.getCaltype().trim().equals("efficiency")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(sourceData.g_e_energy) && CollectionUtils.isNotEmpty(sourceData.g_e_efficiency) && CollectionUtils.isNotEmpty(sourceData.g_e_uncertainty)){
gEfficiencySubBlock = new LinkedList<>();
for (GardsCalibrationPairsOrig orig:gardsCalibrationPairsOrigs) {
for (int i=0; i<sourceData.g_e_energy.size(); i++) {
GEfficiency gEfficiency = new GEfficiency();
if (Objects.nonNull(orig.getYValue()) && Objects.nonNull(orig.getXValue()) && Objects.nonNull(orig.getUncYValue())){
gEfficiency.setEnergy(orig.getXValue());
gEfficiency.setEfficiency(orig.getYValue());
gEfficiency.setUncertainty(orig.getUncYValue());
gEfficiencySubBlock.add(gEfficiency);
}
gEfficiency.setEnergy(sourceData.g_e_energy.get(i));
gEfficiency.setEfficiency(sourceData.g_e_efficiency.get(i));
gEfficiency.setUncertainty(sourceData.g_e_uncertainty.get(i));
gEfficiencySubBlock.add(gEfficiency);
}
}
report.setGEfficiencyBlock(gEfficiencySubBlock);
}
private void findBgEfficiency(Integer sampleId, Report report) {
private void findBgEfficiency(EnergySpectrumStruct sourceData, Report report) {
List<BEfficiency> bgEfficiencySubBlock = null;
LambdaQueryWrapper<GardsBgEfficiencyPairs> bgEfficiencyPairsQueryWrapper = new LambdaQueryWrapper<>();
bgEfficiencyPairsQueryWrapper.eq(GardsBgEfficiencyPairs::getSampleId, sampleId);
List<GardsBgEfficiencyPairs> gardsBgEfficiencyPairs = gardsBgEfficiencyPairsMapper.selectList(bgEfficiencyPairsQueryWrapper);
if (CollectionUtils.isNotEmpty(gardsBgEfficiencyPairs)){
// LambdaQueryWrapper<GardsBgEfficiencyPairs> bgEfficiencyPairsQueryWrapper = new LambdaQueryWrapper<>();
// bgEfficiencyPairsQueryWrapper.eq(GardsBgEfficiencyPairs::getSampleId, sampleId);
// List<GardsBgEfficiencyPairs> gardsBgEfficiencyPairs = gardsBgEfficiencyPairsMapper.selectList(bgEfficiencyPairsQueryWrapper);
if (CollectionUtils.isNotEmpty(sourceData.bg_ROI_number) && CollectionUtils.isNotEmpty(sourceData.bg_nuclide_name) && CollectionUtils.isNotEmpty(sourceData.bg_efficiency) && CollectionUtils.isNotEmpty(sourceData.bg_uncertainty)){
bgEfficiencySubBlock = new LinkedList<>();
for (GardsBgEfficiencyPairs pairs:gardsBgEfficiencyPairs) {
for (int i=0; i<sourceData.bg_ROI_number.size(); i++) {
BEfficiency bEfficiency = new BEfficiency();
if (Objects.nonNull(pairs.getRoi()) && Objects.nonNull(pairs.getNuclideName()) && Objects.nonNull(pairs.getBgEfficiency()) && Objects.nonNull(pairs.getBgEfficError())){
bEfficiency.setRoiNumber(pairs.getRoi());
bEfficiency.setNuclideName(pairs.getNuclideName());
bEfficiency.setCoincidenceEfficiency(pairs.getBgEfficiency());
bEfficiency.setUncertainty(pairs.getBgEfficError());
bgEfficiencySubBlock.add(bEfficiency);
}
bEfficiency.setRoiNumber(sourceData.bg_ROI_number.get(i).intValue());
bEfficiency.setNuclideName(sourceData.bg_nuclide_name.get(i));
bEfficiency.setCoincidenceEfficiency(sourceData.bg_efficiency.get(i));
bEfficiency.setUncertainty(sourceData.bg_uncertainty.get(i));
bgEfficiencySubBlock.add(bEfficiency);
}
}
report.setBgEfficiencyBlock(bgEfficiencySubBlock);
}
private void findRoiLimits(Integer sampleId, Report report) {
private void findRoiLimits(EnergySpectrumStruct sourceData, Report report) {
List<Roi> roiLimitsSubBlock = null;
LambdaQueryWrapper<GardsRoiLimits> roiLimitsQueryWrapper = new LambdaQueryWrapper<>();
roiLimitsQueryWrapper.eq(GardsRoiLimits::getSampleId, sampleId);
roiLimitsQueryWrapper.orderByAsc(GardsRoiLimits::getRoi);
List<GardsRoiLimits> gardsRoiLimitsList = gardsRoiLimitsMapper.selectList(roiLimitsQueryWrapper);
if (CollectionUtils.isNotEmpty(gardsRoiLimitsList)){
// LambdaQueryWrapper<GardsRoiLimits> roiLimitsQueryWrapper = new LambdaQueryWrapper<>();
// roiLimitsQueryWrapper.eq(GardsRoiLimits::getSampleId, sampleId);
// roiLimitsQueryWrapper.orderByAsc(GardsRoiLimits::getRoi);
// List<GardsRoiLimits> gardsRoiLimitsList = gardsRoiLimitsMapper.selectList(roiLimitsQueryWrapper);
if (CollectionUtils.isNotEmpty(sourceData.ROI_number) && CollectionUtils.isNotEmpty(sourceData.POI_B_x1) && CollectionUtils.isNotEmpty(sourceData.POI_B_x2) && CollectionUtils.isNotEmpty(sourceData.POI_G_y1) && CollectionUtils.isNotEmpty(sourceData.POI_G_y2)){
roiLimitsSubBlock = new LinkedList<>();
for (GardsRoiLimits roiLimits:gardsRoiLimitsList) {
for (int i=0; i<sourceData.ROI_number.size(); i++) {
Roi roi = new Roi();
if (Objects.nonNull(roiLimits.getRoi()) && Objects.nonNull(roiLimits.getGEnergyStart()) && Objects.nonNull(roiLimits.getGEnergyStop())
&& Objects.nonNull(roiLimits.getBEnergyStart()) && Objects.nonNull(roiLimits.getBEnergyStop()) ){
roi.setRoiNumber(roiLimits.getRoi());
roi.setRoiGRangeStart(roiLimits.getGEnergyStart());
roi.setRoiGRangeStop(roiLimits.getGEnergyStop());
roi.setRoiBRangeStart(roiLimits.getBEnergyStart());
roi.setRoiBRangeStop(roiLimits.getBEnergyStop());
roiLimitsSubBlock.add(roi);
}
roi.setRoiNumber(Integer.valueOf(sourceData.ROI_number.get(i)));
roi.setRoiGRangeStart(sourceData.POI_G_y1.get(i));
roi.setRoiGRangeStop(sourceData.POI_G_y2.get(i));
roi.setRoiBRangeStart(sourceData.POI_B_x1.get(i));
roi.setRoiBRangeStop(sourceData.POI_B_x2.get(i));
roiLimitsSubBlock.add(roi);
}
}
report.setRoiLimitsBlock(roiLimitsSubBlock);
}
private void findRatios(Integer sampleId, Report report) {
private void findRatios(EnergySpectrumStruct sourceData, Report report) {
List<Ratios> ratiosSubBlock = null;
LambdaQueryWrapper<GardsSampleRatios> ratiosQueryWrapper = new LambdaQueryWrapper<>();
ratiosQueryWrapper.eq(GardsSampleRatios::getSampleId, sampleId);
ratiosQueryWrapper.orderByAsc(GardsSampleRatios::getRatioId);
List<GardsSampleRatios> sampleRatiosList = gardsSampleRatiosMapper.selectList(ratiosQueryWrapper);
if (CollectionUtils.isNotEmpty(sampleRatiosList)){
// LambdaQueryWrapper<GardsSampleRatios> ratiosQueryWrapper = new LambdaQueryWrapper<>();
// ratiosQueryWrapper.eq(GardsSampleRatios::getSampleId, sampleId);
// ratiosQueryWrapper.orderByAsc(GardsSampleRatios::getRatioId);
// List<GardsSampleRatios> sampleRatiosList = gardsSampleRatiosMapper.selectList(ratiosQueryWrapper);
if (CollectionUtils.isNotEmpty(sourceData.count_ratio) && CollectionUtils.isNotEmpty(sourceData.ratio_id) && CollectionUtils.isNotEmpty(sourceData.count_ratio_uncertainty) && CollectionUtils.isNotEmpty(sourceData.ROI_num_lower_G_energy_ROI) && CollectionUtils.isNotEmpty(sourceData.ROI_num_highter_G_energy_ROI)){
ratiosSubBlock = new LinkedList<>();
for (GardsSampleRatios sampleRatios:sampleRatiosList) {
for (int i=0; i<sourceData.ratio_id.size(); i++) {
Ratios ratios = new Ratios();
if (Objects.nonNull(sampleRatios.getCountRatio()) && StringUtils.isNotBlank(sampleRatios.getRatioId()) && Objects.nonNull(sampleRatios.getCountRatioErr())
&& Objects.nonNull(sampleRatios.getLowerRoiNumber()) && Objects.nonNull(sampleRatios.getUpperRoiNumber()) ){
ratios.setCountRatio(sampleRatios.getCountRatio());
ratios.setRatioId(sampleRatios.getRatioId());
ratios.setCountRatioUncertainty(sampleRatios.getCountRatioErr());
ratios.setRoiNumberLowerEnergy(sampleRatios.getLowerRoiNumber());
ratios.setRoiNumberHigherEnergy(sampleRatios.getUpperRoiNumber());
ratiosSubBlock.add(ratios);
}
ratios.setCountRatio(sourceData.count_ratio.get(i));
ratios.setRatioId(sourceData.ratio_id.get(i));
ratios.setCountRatioUncertainty(sourceData.count_ratio_uncertainty.get(i));
ratios.setRoiNumberLowerEnergy(Integer.valueOf(sourceData.ROI_num_lower_G_energy_ROI.get(i)));
ratios.setRoiNumberHigherEnergy(Integer.valueOf(sourceData.ROI_num_highter_G_energy_ROI.get(i)));
ratiosSubBlock.add(ratios);
}
}
report.setRatiosBlock(ratiosSubBlock);
}
private void findGSpectrum(Integer sampleId, Report report) {
private void findGSpectrum(EnergySpectrumStruct sourceData, Report report) {
GammaSpectrum gSpectrumBlock = null;
LambdaQueryWrapper<GardsSpectrum> spectrumQueryWrapper = new LambdaQueryWrapper<>();
spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "G");
spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId);
GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper);
if (Objects.nonNull(gardsSpectrum)){
// LambdaQueryWrapper<GardsSpectrum> spectrumQueryWrapper = new LambdaQueryWrapper<>();
// spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "G");
// spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId);
// GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper);
if (Objects.nonNull(sourceData)){
gSpectrumBlock = new GammaSpectrum();
Map<String, Object> map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.GSPECTRUM.getMessage());
List<Integer> gSpectrumSubBlock = new LinkedList<>();
if (CollectionUtils.isNotEmpty(map)){
gSpectrumSubBlock = (List<Integer>)map.get(SampleFileHeader.GSPECTRUM.getMessage());
// Map<String, Object> map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.GSPECTRUM.getMessage());
// List<Integer> gSpectrumSubBlock = new LinkedList<>();
// if (CollectionUtils.isNotEmpty(map)){
// gSpectrumSubBlock = (List<Integer>)map.get(SampleFileHeader.GSPECTRUM.getMessage());
// }
gSpectrumBlock.setGSpectrumSubBlock(sourceData.g_counts);
if (Objects.nonNull(sourceData.g_energy_span)){
gSpectrumBlock.setEnergySpan(sourceData.g_energy_span);
}
gSpectrumBlock.setGSpectrumSubBlock(gSpectrumSubBlock);
if (Objects.nonNull(gardsSpectrum.getEnergySpan())){
gSpectrumBlock.setEnergySpan(gardsSpectrum.getEnergySpan());
}
if (Objects.nonNull(gardsSpectrum.getChannels())){
gSpectrumBlock.setNumberGChannels(gardsSpectrum.getChannels());
if (Objects.nonNull(sourceData.num_g_channel)){
gSpectrumBlock.setNumberGChannels(sourceData.num_g_channel);
}
}
report.setGSpectrumBlock(gSpectrumBlock);
}
private void findBSpectrum(Integer sampleId, Report report) {
private void findBSpectrum(EnergySpectrumStruct sourceData, Report report) {
BetaSpectrum bSpectrumBlock = null;
LambdaQueryWrapper<GardsSpectrum> spectrumQueryWrapper = new LambdaQueryWrapper<>();
spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "B");
spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId);
GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper);
if (Objects.nonNull(gardsSpectrum)){
// LambdaQueryWrapper<GardsSpectrum> spectrumQueryWrapper = new LambdaQueryWrapper<>();
// spectrumQueryWrapper.eq(GardsSpectrum::getSampleType, "B");
// spectrumQueryWrapper.eq(GardsSpectrum::getSampleId, sampleId);
// GardsSpectrum gardsSpectrum = gardsSpectrumMapper.selectOne(spectrumQueryWrapper);
if (Objects.nonNull(sourceData)){
bSpectrumBlock = new BetaSpectrum();
Map<String, Object> map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.BSPECTRUM.getMessage());
List<Integer> bSpectrumSubBlock = new LinkedList<>();
if (CollectionUtils.isNotEmpty(map)) {
bSpectrumSubBlock = (List<Integer>)map.get(SampleFileHeader.BSPECTRUM.getMessage());
// Map<String, Object> map = readLineUtil.readLine(gardsSpectrum.getFilename(), SampleFileHeader.BSPECTRUM.getMessage());
// List<Integer> bSpectrumSubBlock = new LinkedList<>();
// if (CollectionUtils.isNotEmpty(map)) {
// bSpectrumSubBlock = (List<Integer>)map.get(SampleFileHeader.BSPECTRUM.getMessage());
// }
bSpectrumBlock.setBSpectrumSubBlock(sourceData.b_counts);
if (Objects.nonNull(sourceData.b_energy_span)){
bSpectrumBlock.setEnergySpan(sourceData.b_energy_span);
}
bSpectrumBlock.setBSpectrumSubBlock(bSpectrumSubBlock);
if (Objects.nonNull(gardsSpectrum.getEnergySpan())){
bSpectrumBlock.setEnergySpan(gardsSpectrum.getEnergySpan());
}
if (Objects.nonNull(gardsSpectrum.getChannels())){
bSpectrumBlock.setNumberBChannels(gardsSpectrum.getChannels());
if (Objects.nonNull(sourceData.num_b_channel)){
bSpectrumBlock.setNumberBChannels(sourceData.num_b_channel);
}
}
report.setBSpectrumBlock(bSpectrumBlock);
}
private void findHistogram(Integer sampleId, Report report) {
private void findHistogram(EnergySpectrumStruct sourceData, Report report) {
Histogram histogramBlock = null;
LambdaQueryWrapper<GardsHistogram> histogramQueryWrapper = new LambdaQueryWrapper<>();
histogramQueryWrapper.eq(GardsHistogram::getSampleId, sampleId);
GardsHistogram gardsHistogram = gardsHistogramMapper.selectOne(histogramQueryWrapper);
if (Objects.nonNull(gardsHistogram)){
// LambdaQueryWrapper<GardsHistogram> histogramQueryWrapper = new LambdaQueryWrapper<>();
// histogramQueryWrapper.eq(GardsHistogram::getSampleId, sampleId);
// GardsHistogram gardsHistogram = gardsHistogramMapper.selectOne(histogramQueryWrapper);
if (Objects.nonNull(sourceData)){
histogramBlock = new Histogram();
Map<String, Object> map = readLineUtil.readLine(gardsHistogram.getFilename(), SampleFileHeader.HISTOGRAM.getMessage());
List<HistogramData> histogramSubBlock = new LinkedList<>();
if (CollectionUtils.isNotEmpty(map)) {
histogramSubBlock = (List<HistogramData>)map.get(SampleFileHeader.HISTOGRAM.getMessage());
}
List<HistogramData> histogramSubBlock = readValue(sourceData);
// Map<String, Object> map = readLineUtil.readLine(gardsHistogram.getFilename(), SampleFileHeader.HISTOGRAM.getMessage());
// List<HistogramData> histogramSubBlock = new LinkedList<>();
// if (CollectionUtils.isNotEmpty(map)) {
// histogramSubBlock = (List<HistogramData>)map.get(SampleFileHeader.HISTOGRAM.getMessage());
// }
histogramBlock.setHistogramSubBlock(histogramSubBlock);
if (Objects.nonNull(gardsHistogram.getBChannels())){
histogramBlock.setBChannels(gardsHistogram.getBChannels());
if (Objects.nonNull(sourceData.b_channels)){
histogramBlock.setBChannels(sourceData.b_channels);
}
if (Objects.nonNull(gardsHistogram.getBEnergySpan())){
histogramBlock.setBEnergySpan(gardsHistogram.getBEnergySpan());
if (Objects.nonNull(sourceData.b_h_energy_span)){
histogramBlock.setBEnergySpan(sourceData.b_h_energy_span);
}
if (Objects.nonNull(gardsHistogram.getGChannels())){
histogramBlock.setGChannels(gardsHistogram.getGChannels());
if (Objects.nonNull(sourceData.g_channels)){
histogramBlock.setGChannels(sourceData.g_channels);
}
if (Objects.nonNull(gardsHistogram.getGEnergySpan())){
histogramBlock.setGEnergySpan(gardsHistogram.getGEnergySpan());
if (Objects.nonNull(sourceData.g_h_energy_span)){
histogramBlock.setGEnergySpan(sourceData.g_h_energy_span);
}
}
report.setHistogramBlock(histogramBlock);
}
private void findCertificate(Integer sampleId, Report report) {
private void findCertificate(EnergySpectrumStruct sourceData, Report report) {
Certificate certificateBlock = null;
LambdaQueryWrapper<GardsSampleCert> sampleCertQueryWrapper = new LambdaQueryWrapper<>();
sampleCertQueryWrapper.eq(GardsSampleCert::getSampleId, sampleId);
GardsSampleCert gardsSampleCert = gardsSampleCertMapper.selectOne(sampleCertQueryWrapper);
if (Objects.nonNull(gardsSampleCert)) {
certificateBlock = new Certificate();
if (Objects.nonNull(gardsSampleCert.getQuantity())){
certificateBlock.setTotalSourceActivity(gardsSampleCert.getQuantity());
}
if (Objects.nonNull(gardsSampleCert.getAssayDate())){
certificateBlock.setAssayDate(DateUtils.formatDate(gardsSampleCert.getAssayDate(), "yyyy-MM-dd HH:mm:ss"));
}
if (StringUtils.isNotBlank(gardsSampleCert.getUnit())){
certificateBlock.setUnitsOfActivity(gardsSampleCert.getUnit());
}
}
LambdaQueryWrapper<GardsSampleCertLine> sampleCertLineQueryWrapper = new LambdaQueryWrapper<>();
sampleCertLineQueryWrapper.eq(GardsSampleCertLine::getSampleId, sampleId);
List<GardsSampleCertLine> gardsSampleCertLines = gardsSampleCertLineMapper.selectList(sampleCertLineQueryWrapper);
if (CollectionUtils.isNotEmpty(gardsSampleCertLines)) {
if (Objects.isNull(certificateBlock)){
// LambdaQueryWrapper<GardsSampleCert> sampleCertQueryWrapper = new LambdaQueryWrapper<>();
// sampleCertQueryWrapper.eq(GardsSampleCert::getSampleId, sampleId);
// GardsSampleCert gardsSampleCert = gardsSampleCertMapper.selectOne(sampleCertQueryWrapper);
try {
if (Objects.nonNull(sourceData)) {
certificateBlock = new Certificate();
if (Objects.nonNull(sourceData.total_source_activity)){
certificateBlock.setTotalSourceActivity(sourceData.total_source_activity);
}
if (StringUtils.isNotBlank(sourceData.assay_date) && StringUtils.isNotBlank(sourceData.assay_time)){
Date assayDate = DateUtils.parseDate(sourceData.assay_date + " " + sourceData.assay_time);
certificateBlock.setAssayDate(DateUtils.formatDate(assayDate, "yyyy-MM-dd HH:mm:ss"));
}
if (StringUtils.isNotBlank(sourceData.units_activity)){
certificateBlock.setUnitsOfActivity(sourceData.units_activity);
}
}
List<CertificateLine> certificateSubBlock = new LinkedList<>();
for (GardsSampleCertLine sampleCertLine:gardsSampleCertLines) {
CertificateLine certificateLine = new CertificateLine();
if (StringUtils.isNotBlank(sampleCertLine.getNuclName())){
certificateLine.setNuclideName(sampleCertLine.getNuclName());
// LambdaQueryWrapper<GardsSampleCertLine> sampleCertLineQueryWrapper = new LambdaQueryWrapper<>();
// sampleCertLineQueryWrapper.eq(GardsSampleCertLine::getSampleId, sampleId);
// List<GardsSampleCertLine> gardsSampleCertLines = gardsSampleCertLineMapper.selectList(sampleCertLineQueryWrapper);
if (CollectionUtils.isNotEmpty(sourceData.nuclide_name) && CollectionUtils.isNotEmpty(sourceData.half_life_time) && CollectionUtils.isNotEmpty(sourceData.activity_nuclide_time_assay)
&& CollectionUtils.isNotEmpty(sourceData.uncertainty) && CollectionUtils.isNotEmpty(sourceData.cer_g_energy) && CollectionUtils.isNotEmpty(sourceData.g_intensity)
&& CollectionUtils.isNotEmpty(sourceData.electron_decay_mode) && CollectionUtils.isNotEmpty(sourceData.maximum_energy) && CollectionUtils.isNotEmpty(sourceData.intensity_b_particle)) {
if (Objects.isNull(certificateBlock)){
certificateBlock = new Certificate();
}
if (StringUtils.isNotBlank(sampleCertLine.getHalflife())){
certificateLine.setHalfLife(sampleCertLine.getHalflife());
List<CertificateLine> certificateSubBlock = new LinkedList<>();
for (int i=0; i<sourceData.nuclide_name.size(); i++) {
CertificateLine certificateLine = new CertificateLine();
certificateLine.setNuclideName(sourceData.nuclide_name.get(i));
certificateLine.setHalfLife(sourceData.half_life_time.get(i));
certificateLine.setNuclideActivity(sourceData.activity_nuclide_time_assay.get(i));
certificateLine.setUncertainty(sourceData.uncertainty.get(i));
certificateLine.setGenergy(sourceData.cer_g_energy.get(i));
certificateLine.setIntensity(sourceData.g_intensity.get(i));
certificateLine.setElectronDecayModeDescriptor(sourceData.electron_decay_mode.get(i));
certificateLine.setMaxBParticleEnergy(sourceData.maximum_energy.get(i));
certificateLine.setParticleBIntensity(sourceData.intensity_b_particle.get(i));
certificateSubBlock.add(certificateLine);
}
if (Objects.nonNull(sampleCertLine.getActivity())){
certificateLine.setNuclideActivity(sampleCertLine.getActivity());
}
if (Objects.nonNull(sampleCertLine.getError())){
certificateLine.setUncertainty(sampleCertLine.getError());
}
if (Objects.nonNull(sampleCertLine.getEnergy())){
certificateLine.setGenergy(sampleCertLine.getEnergy());
}
if (Objects.nonNull(sampleCertLine.getAbundance())){
certificateLine.setIntensity(sampleCertLine.getAbundance());
}
if (StringUtils.isNotBlank(sampleCertLine.getDecayMode())){
certificateLine.setElectronDecayModeDescriptor(sampleCertLine.getDecayMode());
}
if (Objects.nonNull(sampleCertLine.getBEnergy())){
certificateLine.setMaxBParticleEnergy(sampleCertLine.getBEnergy());
}
if (Objects.nonNull(sampleCertLine.getBAbundance())){
certificateLine.setParticleBIntensity(sampleCertLine.getBAbundance());
}
certificateSubBlock.add(certificateLine);
certificateBlock.setCertificateSubBlock(certificateSubBlock);
}
certificateBlock.setCertificateSubBlock(certificateSubBlock);
report.setCertificateBlock(certificateBlock);
} catch (ParseException e) {
throw new RuntimeException(e);
}
report.setCertificateBlock(certificateBlock);
}
public List<HistogramData> readValue(EnergySpectrumStruct sourceData) {
List<HistogramData> result = new LinkedList<>();
if (CollectionUtils.isNotEmpty(sourceData.h_counts) && Objects.nonNull(sourceData.g_channels) && Objects.nonNull(sourceData.b_channels)) {
for (int i=0; i<sourceData.g_channels; i++) {
for (int j=0; j<sourceData.b_channels; j++) {
List<Long> subList = sourceData.h_counts.subList((int) (i * sourceData.b_channels), (int) ((i + 1) * sourceData.b_channels));
if (!"0".equals(String.valueOf(subList.get(j)))){
HistogramData histogramData = new HistogramData();
histogramData.setG(i);
histogramData.setB(j);
histogramData.setC(subList.get(j).intValue());
result.add(histogramData);
}
}
}
}
return result;
}
@Override

View File

@ -7,7 +7,6 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.codec.language.bm.Lang;
import org.apache.poi.ss.usermodel.Workbook;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;