diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/postgre/SysEmail.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/postgre/SysEmail.java index 1f06aabc..22472c07 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/postgre/SysEmail.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/postgre/SysEmail.java @@ -18,7 +18,7 @@ import java.time.LocalDate; @TableName(value = "sys_email") public class SysEmail implements Serializable { - @TableId(value = "id", type = IdType.ASSIGN_ID) + @TableId(value = "id", type = IdType.AUTO) private String id; @TableField("name") diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/enums/FittingEquation.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/enums/FittingEquation.java new file mode 100644 index 00000000..0fe35ff4 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/enums/FittingEquation.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.base.enums; + +public enum FittingEquation { + + DEFAULT(0, "(?1)+(?2)*x+(?3)x*x"), + LINER(1, "(?1)+(?2)*x"), + POLY2(2, "(?1)+(?2)*x+(?3)x*x"), + POLY3(3, "_3PloynimialFitEquation"), + GAUSS(4, "GaussFitEquation"); + + private Integer code; + + private String description; + + FittingEquation(Integer code, String description){ + this.code = code; + this.description = description; + } + + public Integer getCode() { + return code; + } + + public String getDescription() { + return description; + } +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/BlockConstant.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/BlockConstant.java index 82882588..9e3550ef 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/BlockConstant.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/BlockConstant.java @@ -14,5 +14,8 @@ public interface BlockConstant { public final static String XE_133 = "Xe133"; public final static String XE_135 = "Xe135"; + public final static String CH_Contant = "CH(x)"; + public final static String E_Contant = "E(x)"; + } diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationServiceImpl.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationServiceImpl.java index a7924660..7c4d533a 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationServiceImpl.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationServiceImpl.java @@ -3,15 +3,11 @@ package org.jeecg.modules.service.impl; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.modules.base.entity.rnauto.GardsCalibration; -import org.jeecg.modules.base.entity.rnauto.GardsCalibrationPairs; import org.jeecg.modules.mapper.GardsCalibrationMapper; -import org.jeecg.modules.mapper.GardsCalibrationPairsMapper; -import org.jeecg.modules.native_jni.EnergySpectrumHandler; import org.jeecg.modules.native_jni.struct.BgAnalyseResult; import org.jeecg.modules.service.BlockConstant; import org.jeecg.modules.service.GardsCalibrationService; import org.springframework.stereotype.Service; - import java.util.Date; @Service @@ -196,13 +192,4 @@ public class GardsCalibrationServiceImpl extends ServiceImpl list = Lists.newArrayList(); + //C++那边没有补0,先加上后续解决后再删除 + analyseResult.LC.add(0,0.0D); for(int i=0;i 0){ Date acquisitionStop = new Date((long) (gardsSampleData.getAcquisitionStart().getTime()+(struct.acquisition_live_time*1000))); @@ -122,7 +123,7 @@ public class SpectrumBaseBlockServiceImpl implements ISpectrumBaseBlockService { gardsSampleAux.setSampleHeight(struct.dimension_2); gardsSampleAux.setSampleDiameter(struct.dimension_1); if(StringUtils.isNotBlank(struct.date_calibration) && StringUtils.isNotBlank(struct.time_calibration)){ - gardsSampleAux.setCalibrationDtg(DateUtils.parseDate(struct.date_calibration+" "+struct.time_calibration)); + gardsSampleAux.setCalibrationDtg(DateUtils.parseDate(struct.date_calibration+StringConstant.SPACE+struct.time_calibration)); } gardsSampleAux.setMsgId(struct.msg_id); gardsSampleAux.setArchiveBottleId(struct.archive_bottle_id); diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/S_D_Q_G_SpectrumHandler.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/S_D_Q_G_SpectrumHandler.java index 58378faf..8ec056d0 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/S_D_Q_G_SpectrumHandler.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/S_D_Q_G_SpectrumHandler.java @@ -8,6 +8,7 @@ import org.jeecg.common.constant.StringConstant; import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.util.DateUtils; import org.jeecg.modules.base.entity.original.GardsSampleData; +import org.jeecg.modules.base.enums.DataType; import org.jeecg.modules.config.datasource.DataSourceSwitcher; import org.jeecg.modules.exception.AcquisitionBlockException; import org.jeecg.modules.exception.FileRepeatException; @@ -20,6 +21,8 @@ import org.springframework.boot.system.ApplicationHome; import org.springframework.transaction.TransactionStatus; import java.io.*; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; @@ -149,11 +152,37 @@ public abstract class S_D_Q_G_SpectrumHandler extends SpectrumHandler{ newFileName.append(StringConstant.UNDER_LINE); newFileName.append(this.sourceData.spectrum_quantity); newFileName.append(StringConstant.UNDER_LINE); - newFileName.append(this.sourceData.acquisition_live_time); + newFileName.append(handleLiveTime()); newFileName.append(super.currDataType.getSuffix()); mailFile = FileUtil.rename(mailFile,newFileName.toString(),true); } + /** + * 处理acquisition_live_time字段 + * @return + */ + private String handleLiveTime(){ + BigDecimal bg = new BigDecimal(this.sourceData.acquisition_live_time); + //将acquisition_live_time保留一位小数 如果保留一位小数后小数点后的值是0则四舍五入保留整数,否则按正常条件四舍五入保留小数位 + String scale = bg.setScale(1, RoundingMode.HALF_UP).toPlainString(); + if(DataType.SAMPLEPHD.getType().equals(super.currDataType.getType()) || DataType.GASBKPHD.getType().equals(super.currDataType.getType())){ + if (scale.indexOf(".0") > 0) { + bg = bg.setScale(0, RoundingMode.HALF_UP); + } else { + bg = bg.setScale(1, RoundingMode.HALF_UP); + } + }else if(DataType.DETBKPHD.getType().equals(super.currDataType.getType())){ + bg = bg.setScale(0, RoundingMode.HALF_UP); + }else if(DataType.QCPHD.getType().equals(super.currDataType.getType())){ + if (scale.indexOf(".0") > 0) { + bg = bg.setScale(0, RoundingMode.HALF_UP); + } else { + bg = bg.setScale(2, RoundingMode.HALF_UP); + } + } + return bg.toPlainString(); + } + /** * 读取邮件内容#开头的标签 * @throws Exception diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_B_Analysis.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_B_Analysis.java index fa919a1d..e3d6f712 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_B_Analysis.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_B_Analysis.java @@ -1,12 +1,19 @@ package org.jeecg.modules.spectrum; +import cn.hutool.core.io.FileUtil; +import com.google.common.collect.Lists; +import io.swagger.models.auth.In; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.constant.StringConstant; import org.jeecg.common.properties.SpectrumPathProperties; +import org.jeecg.common.util.DateUtils; import org.jeecg.modules.base.entity.original.GardsSampleData; import org.jeecg.modules.base.entity.rnauto.GardsAnalyses; import org.jeecg.modules.base.enums.DataType; import org.jeecg.modules.base.enums.DataTypeAbbr; +import org.jeecg.modules.base.enums.FittingEquation; import org.jeecg.modules.base.enums.SampleStatus; import org.jeecg.modules.config.datasource.DataSourceSwitcher; import org.jeecg.modules.exception.BAnalyseException; @@ -15,22 +22,27 @@ import org.jeecg.modules.ftp.FTPUtils; import org.jeecg.modules.native_jni.EnergySpectrumHandler; import org.jeecg.modules.native_jni.struct.BgAnalyseResult; import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct; +import org.jeecg.modules.service.BlockConstant; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; import org.springframework.transaction.TransactionStatus; -import java.io.File; -import java.io.IOException; + +import java.io.*; +import java.nio.file.Files; import java.time.LocalDate; -import java.util.Date; -import java.util.Objects; +import java.util.*; +import java.util.stream.Collectors; /** * B谱分析过程 */ -public class Sample_B_Analysis { +public class Sample_B_Analysis implements BlockConstant { /** * 报告文件后缀 */ private static final String ARR_FILE_SUFFIX = ".txt"; + private static final String ARR_FILE_NAME_TAIL = "_rpt"; /** * 正常分析过程日志 */ @@ -47,10 +59,18 @@ public class Sample_B_Analysis { * sample谱原始数据 */ private GardsSampleData sampleData = null; + /** + * gas谱结构体数据 + */ + private EnergySpectrumStruct gasStruct = null; /** * gas谱原始数据 */ private GardsSampleData detSampleData = null; + /** + * det谱结构体数据 + */ + private EnergySpectrumStruct detStruct = null; /** * det谱原始数据 */ @@ -104,8 +124,11 @@ public class Sample_B_Analysis { */ private Date endAnalysisTime; - public Sample_B_Analysis(GardsSampleData sampleData,String sampleTempFilePath,SpectrumServiceQuotes spectrumServiceQuotes, - EnergySpectrumStruct sampleStruct,FTPUtils ftpUtil,String logFilePath,String logFileName){ + public Sample_B_Analysis() { + } + + public Sample_B_Analysis(GardsSampleData sampleData, String sampleTempFilePath, SpectrumServiceQuotes spectrumServiceQuotes, + EnergySpectrumStruct sampleStruct, FTPUtils ftpUtil, String logFilePath, String logFileName){ this.sampleData = sampleData; this.sampleTempFilePath = sampleTempFilePath; this.spectrumServiceQuotes = spectrumServiceQuotes; @@ -132,6 +155,9 @@ public class Sample_B_Analysis { this.autoAnalyse(); //存储数据 this.storageDataToDatabase(); + //生成报告 + Sample_B_Analysis.B_AnalysisReport report = new Sample_B_Analysis.B_AnalysisReport(); + report.start(); //删除下载的det和gas临时文件 this.deleteLocalTemporaryFile(); }catch (Exception e){ @@ -187,8 +213,9 @@ public class Sample_B_Analysis { ftpPath.append(StringConstant.SLASH); ftpPath.append(month>=10?month:"0"+month); this.arrFilePath = ftpPath.toString(); - final String filePath = this.sampleData.getInputFileName().replace(DataType.SAMPLEPHD.getSuffix(), ARR_FILE_SUFFIX); - this.arrFileName = filePath.substring(filePath.lastIndexOf(StringConstant.SLASH)+1); + String arrFileTail = ARR_FILE_NAME_TAIL+ARR_FILE_SUFFIX; + String sourceFileName = this.sampleData.getInputFileName().substring(this.sampleData.getInputFileName().lastIndexOf(StringConstant.SLASH)+1); + this.arrFileName = sourceFileName.replace(DataType.SAMPLEPHD.getSuffix(),arrFileTail); } /** @@ -201,9 +228,8 @@ public class Sample_B_Analysis { System.out.println("det:"+this.detTempFilePath); BgAnalyseResult analyseResult = EnergySpectrumHandler.bgAnalyse(this.sampleTempFilePath,this.gasTempFilePath,this.detTempFilePath); - System.out.println(analyseResult); this.endAnalysisTime = new Date(); - if(Objects.isNull(analyseResult)){ + if(Objects.isNull(analyseResult) || !analyseResult.analyse_flag){ throw new BAnalyseException("THE PHD file cannot be parsed:"+this.sampleTempFilePath+","+this.gasTempFilePath+","+this.detTempFilePath); } this.analyseResult = analyseResult; @@ -252,16 +278,16 @@ public class Sample_B_Analysis { this.gasSampleData,this.startAnalysisTime,this.endAnalysisTime,logFileRelativePath,arrFileRelativePath); //调用原始数据dll获取gas、det谱数据入库,sample已有数据直接入库 //存储sample谱B_Energy和G_Energy块数据 - spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(sampleData.getSampleId(),analyses.getIdAnalysis(),sampleStruct); - spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(sampleData.getSampleId(),analyses.getIdAnalysis(),sampleStruct); + spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(sampleData.getSampleId(),analyses.getIdAnalysis(),this.sampleStruct); + spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(sampleData.getSampleId(),analyses.getIdAnalysis(),this.sampleStruct); //存储det谱B_Energy和G_Energy块数据 - final EnergySpectrumStruct detStruct = EnergySpectrumHandler.getSourceData(detSampleData.getInputFileName()); - spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(detSampleData.getSampleId(),analyses.getIdAnalysis(),detStruct); - spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(detSampleData.getSampleId(),analyses.getIdAnalysis(),detStruct); + this.detStruct = EnergySpectrumHandler.getSourceData(detSampleData.getInputFileName()); + spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(detSampleData.getSampleId(),analyses.getIdAnalysis(),this.detStruct); + spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(detSampleData.getSampleId(),analyses.getIdAnalysis(),this.detStruct); //存储gas谱B_Energy和G_Energy块数据 - final EnergySpectrumStruct gasStruct = EnergySpectrumHandler.getSourceData(gasSampleData.getInputFileName()); - spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(gasSampleData.getSampleId(),analyses.getIdAnalysis(),gasStruct); - spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(gasSampleData.getSampleId(),analyses.getIdAnalysis(),gasStruct); + this.gasStruct = EnergySpectrumHandler.getSourceData(gasSampleData.getInputFileName()); + spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(gasSampleData.getSampleId(),analyses.getIdAnalysis(),this.gasStruct); + spectrumServiceQuotes.getGardsCalibrationPairsService().createG_EnergyRecord(gasSampleData.getSampleId(),analyses.getIdAnalysis(),this.gasStruct); //存储gards_calibration表数据sample、det、gas谱B_Energy和G_Energy块数据 spectrumServiceQuotes.getGardsCalibrationService().create(this.analyseResult,gasSampleData.getSampleId(),analyses.getIdAnalysis()); @@ -296,4 +322,526 @@ public class Sample_B_Analysis { gasFile.delete(); } } + + public Sample_B_Analysis.B_AnalysisReport getReport(){ + + return new Sample_B_Analysis.B_AnalysisReport(); + } + + /** + * B谱分析报告 + */ + private class B_AnalysisReport{ + /** + * 模版内容 + */ + private String templateContent; + /** + * 报告临时文件 + */ + private File reportTmpFile; + + /** + * 开始处理报告内容 + */ + public void start() throws IOException { + //获取报告内容 + this.getTemplateContent(); + //创建报告临时文件 + this.createTmpReportFile(); + //处理报告时间 + this.handleReportCreateDate(); + //处理#FILE INFORMATION 模块 + this.handleFileInfoMation(); + //处理#COLLECTION INFORMATION 模块 + this.handleCollectionInfoMation(); + //处理#ACQUISITION INFORMATION 模块 + this.handleAcquistionInfoMation(); + //处理#SOFTWARE 模块 + this.handleSoftware(); + //处理Sample谱、Gas谱、Det谱sampleId + this.handleSampleId(); + //把已经替换好的字符写入文件 + this.reportTmpFile = FileUtil.writeString(this.templateContent,this.reportTmpFile,"utf-8"); + //处理#SAMPLE CALIBRATION 模块 + this.handleSampleCalibration(); + //处理#SAMPLE LIMITS PER ROI 模块 + this.handleSampleLimits(); + //处理#DET CALIBRATION 模块 + this.handleDetCalibration(); + //处理#DET LIMITS PER ROI 模块 + this.handleDetLimits(); + //处理#GAS CALIBRATION 模块 + this.handleGasCalibration(); + //处理#GAS LIMITS PER ROI 模块 + this.handleGasLimits(); + //处理 #GROSS COUNTS PER ROI 模块 + this.handleGrossCounts(); + //处理#NET COUNTS AND LC PER ROI模块 + this.handleNetCountsAndLC(); + //处理#CONCENTRATION AND LC PER ROI 模块 + this.handleConcentrationAndLC(); + //处理#RESULT SUMMARY 模块 + this.handleResultSummary(); + //把报告存储到ftp + this.saveReportToFtp(); + } + + /** + * 获取报告内容 + * @throws IOException + */ + private void getTemplateContent() throws IOException { + Resource resource = new ClassPathResource("template/b_report_template.txt"); + this.templateContent = FileUtil.readUtf8String(resource.getFile()); + } + + /** + * 创建报告临时文件 + * @throws IOException + */ + private void createTmpReportFile() throws IOException { + String reportTmpFilePath = spectrumServiceQuotes.getTaskProperties().getTemporaryStoragePath()+ File.separator+arrFileName; + this.reportTmpFile = new File(reportTmpFilePath); + if(!this.reportTmpFile.exists()){ + this.reportTmpFile.createNewFile(); + } + } + + /** + * 处理报告时间 + */ + private void handleReportCreateDate(){ + final String createDate = DateUtils.formatDate(new Date(), "yyyy/MM/dd-HH:mm:ss"); + this.templateContent = this.templateContent.replace("${create_date}",createDate); + } + + /** + * 处理#FILE INFORMATION 模块 + */ + private void handleFileInfoMation(){ + this.templateContent = this.templateContent.replace("${SampleMeasID}",sampleStruct.measurement_id); + this.templateContent = this.templateContent.replace("${GASBKMeasID}",sampleStruct.gas_bk_measurement_id); + this.templateContent = this.templateContent.replace("${DETBKMeasID}",sampleStruct.detector_bk_measurement_id); + this.templateContent = this.templateContent.replace("${SRID}",sampleStruct.sample_ref_id); + this.templateContent = this.templateContent.replace("${DetectorType}","3D b-g"); + } + + /** + * 处理#COLLECTION INFORMATION 模块 + */ + private void handleCollectionInfoMation(){ + this.templateContent = this.templateContent.replace("${StationID}",sampleStruct.site_code); + this.templateContent = this.templateContent.replace("${DetectorID}",sampleStruct.detector_code); + this.templateContent = this.templateContent.replace("${CollectionStart}",sampleStruct.collection_start_date+StringConstant.SPACE+sampleStruct.collection_start_time); + this.templateContent = this.templateContent.replace("${CollectionStop}",sampleStruct.collection_stop_date+StringConstant.SPACE+sampleStruct.collection_stop_time); + this.templateContent = this.templateContent.replace("${CollectionTIME}",String.valueOf((sampleData.getCollectStart().getTime()-sampleData.getCollectStop().getTime())/1000)); + this.templateContent = this.templateContent.replace("${AirVolume}",String.valueOf(sampleStruct.air_volume)); + this.templateContent = this.templateContent.replace("${XeVolume}",String.valueOf(sampleStruct.sample_volume_of_Xe)); + } + + /** + * 处理#ACQUISITION INFORMATION 模块 + */ + private void handleAcquistionInfoMation(){ + this.templateContent = this.templateContent.replace("${AcquisitionStart}",sampleStruct.acquisition_start_date+StringConstant.SPACE+sampleStruct.acquisition_start_time); + this.templateContent = this.templateContent.replace("${AcqRealTime}",String.valueOf(sampleStruct.acquisition_real_time)); + this.templateContent = this.templateContent.replace("${AcqLiveTime}",String.valueOf(sampleStruct.acquisition_live_time)); + } + + /** + * 处理#SOFTWARE 模块 + */ + private void handleSoftware(){ + this.templateContent = this.templateContent.replace("${version}",spectrumServiceQuotes.getSoftwareProperties().getSwVersion()); + } + + /** + * 处理Sample谱、Gas谱、Det谱sampleId + */ + private void handleSampleId(){ + this.templateContent = this.templateContent.replace("${SampleID}",sampleData.getSampleId().toString()); + this.templateContent = this.templateContent.replace("${DET_SampleID}",detSampleData.getSampleId().toString()); + this.templateContent = this.templateContent.replace("${GAS_SampleID}",gasSampleData.getSampleId().toString()); + } + + /** + * 处理#SAMPLE CALIBRATION 模块 + * 还需和周雨涵确认s_b_fitting_c_e、s_g_fitting_c_e + */ + private void handleSampleCalibration() throws IOException { + String[] betaArr = {CH_Contant+this.calibration(analyseResult.s_b_fitting_type,analyseResult.s_b_fitting_e_c), + E_Contant+this.calibration(analyseResult.s_b_fitting_type,analyseResult.s_b_fitting_e_c)}; + + String[] gammaArr = {CH_Contant+this.calibration(analyseResult.s_g_fitting_type,analyseResult.s_g_fitting_e_c), + E_Contant+this.calibration(analyseResult.s_g_fitting_type,analyseResult.s_g_fitting_e_c)}; + + this.handleTwoParamFormat("#SAMPLE CALIBRATION",betaArr,gammaArr); + } + + /** + * 处理#SAMPLE LIMITS PER ROI 模块 + */ + private void handleSampleLimits() throws IOException { + List b_chan_start = analyseResult.S_ROI_B_Boundary_start; + List b_chan_stop = analyseResult.S_ROI_B_Boundary_stop; + List g_chan_start = analyseResult.S_ROI_G_Boundary_start; + List g_chan_stop = analyseResult.S_ROI_G_Boundary_stop; + + List roi = analyseResult.S_ROI.stream().map(Object::toString).collect(Collectors.toList()); + List beta = Lists.newArrayList(); + List gamma = Lists.newArrayList(); + String flag = " to "; + for(int i=0;i b_chan_start = analyseResult.D_ROI_B_Boundary_start; + List b_chan_stop = analyseResult.D_ROI_B_Boundary_stop; + List g_chan_start = analyseResult.D_ROI_G_Boundary_start; + List g_chan_stop = analyseResult.D_ROI_G_Boundary_stop; + + List roi = analyseResult.D_ROI.stream().map(Object::toString).collect(Collectors.toList()); + List beta = Lists.newArrayList(); + List gamma = Lists.newArrayList(); + String flag = " to "; + for(int i=0;i b_chan_start = analyseResult.G_ROI_B_Boundary_start; + List b_chan_stop = analyseResult.G_ROI_B_Boundary_stop; + List g_chan_start = analyseResult.G_ROI_G_Boundary_start; + List g_chan_stop = analyseResult.G_ROI_G_Boundary_stop; + + List roi = analyseResult.G_ROI.stream().map(Object::toString).collect(Collectors.toList()); + List beta = Lists.newArrayList(); + List gamma = Lists.newArrayList(); + String flag = " to "; + for(int i=0;i roi = analyseResult.ROI.stream().map(Object::toString).collect(Collectors.toList()); + List s_roi_cts = analyseResult.s_roi_cts.stream().map(v->formatToStr5(v)).collect(Collectors.toList()); + List g_roi_cts = analyseResult.g_roi_cts.stream().map(v->formatToStr5(v)).collect(Collectors.toList()); + List d_roi_cts = analyseResult.d_roi_cts.stream().map(v->formatToStr5(v)).collect(Collectors.toList()); + + this.handleFourParamFormat("#GROSS COUNTS PER ROI",roi,s_roi_cts,g_roi_cts,d_roi_cts); + } + + /** + * 处理#NET COUNTS AND LC PER ROI模块 + */ + private void handleNetCountsAndLC() throws IOException { + List roi_net_count = analyseResult.ROI_net_coutns; + List roi_net_count_err = analyseResult.ROI_net_coutns_err; + + List roi = analyseResult.ROI.stream().map(Object::toString).collect(Collectors.toList()); + List lc = analyseResult.LC.stream().map(v->formatToStr5(v)).collect(Collectors.toList()); + List netCount = Lists.newArrayList(); + String flag = " +/- "; + for(int i=0;i con = analyseResult.ROI_con_uncer; + List conErr = analyseResult.ROI_con_uncer_err; + analyseResult.LC.add(0,0.0D); + String flag = " +/- "; + List roi = analyseResult.ROI.stream().map(Object::toString).collect(Collectors.toList()); + List lc = analyseResult.LC.stream().map(v->formatToStr5(v)).collect(Collectors.toList()); + List mdc = Lists.newArrayList();//analyseResult.MDC.stream().map(Object::toString).collect(Collectors.toList()); + for(int i=0;i<10;i++){ + mdc.add("0.0"); + } + List conc = Lists.newArrayList(); + for(int i=0;ianalyseResult.MDC_Xe135?"1":"0"; + String xe_131m_nid_flag = analyseResult.Xe131m_con>analyseResult.MDC_Xe131m?"1":"0"; + String xe_133m_nid_flag = analyseResult.Xe133m_con>analyseResult.MDC_Xe133m?"1":"0"; + String xe_133_nid_flag = analyseResult.Xe133_con>analyseResult.MDC_Xe133?"1":"0"; + String[] nid_flag = {xe_135_nid_flag,xe_131m_nid_flag,xe_133m_nid_flag,xe_133_nid_flag}; + + this.handleFiveParamFormat("#RESULT SUMMARY",nuclideName,conc,uncertainty,mdc,nid_flag); + } + + /** + * 保存报告到ftp + */ + private void saveReportToFtp() throws FileNotFoundException { + ftpUtil.saveFile(arrFilePath,arrFileName,new FileInputStream(this.reportTmpFile)); + this.reportTmpFile.delete(); + } + + /** + * 获取sample、gas、det谱Beta和Gamma的CH(x)、E(x) + * @return + */ + private String calibration(Integer fitting_type, List fitting_e_c){ + String b_fittingEquation = this.getFittingEquation(fitting_type); + for(int i=0;i lines = FileUtils.readLines(this.reportTmpFile, "utf-8"); + for(int i=0;i param,List param1,List param2) throws IOException { + final List lines = FileUtils.readLines(this.reportTmpFile, "utf-8"); + for(int i=0;i param,List param1,List param2,List param3) throws IOException { + final List lines = FileUtils.readLines(this.reportTmpFile, "utf-8"); + for(int i=0;i lines = FileUtils.readLines(this.reportTmpFile, "utf-8"); + for(int i=0;i lines = FileUtils.readLines(file, "utf-8"); + + String[] betaArr = {"CH(x) = (-3.33443)+(0.398048)*x+(-0.000124015)x*x","E(x) = (12.0809)+(2.39764)*x+(0.00331138)x*x"}; + + String[] gammaArr = {"CH(x) = (0.879727)+(0.365551)*x+(-2.82212e-05)x*x","E(x) = (0.879727)+(0.365551)*x+(-2.82212e-05)x*x"}; + + for(int i=0;i