Merge remote-tracking branch 'origin/station' into station

This commit is contained in:
qiaoqinzheng 2023-11-13 10:41:06 +08:00
commit 329e6859b9
12 changed files with 635 additions and 74 deletions

View File

@ -245,7 +245,7 @@ public class FTPUtil {
try {
if (ObjectUtil.isNotNull(inputStream))inputStream.close();
if (ObjectUtil.isNotNull(outputStream))outputStream.close();
ftpClient.disconnect();
if (ObjectUtil.isNotNull(ftpClient))ftpClient.disconnect();
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -0,0 +1,11 @@
package org.jeecg.modules.base.dto;
import lombok.Data;
@Data
public class Calibration {
private String beta;
private String gamma;
}

View File

@ -0,0 +1,66 @@
package org.jeecg.modules.base.dto;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
import org.jeecg.common.util.NumUtil;
@Data
public class ROIResultsStrDto {
/**
* 感兴趣区ID号
*/
private Integer roi;
/**
* 样品谱感兴趣区总计数
*/
private Double sGross;
/**
* 气体本底谱感兴趣区总计数
*/
private Double gGross;
/**
* 探测器本底谱感兴趣区总计数
*/
private Double bGross;
/**
* 感兴趣区净计数
*/
private Double net;
/**
* 感兴趣区净计数不确定度
*/
private Double netErr;
/**
* 感兴趣区活度浓度
*/
private Double conc;
/**
* 感兴趣区活度浓度不确定度
*/
private Double concErr;
/**
* 感兴趣区LC
*/
private String lc;
private String lcCts = "";
/**
* 感兴趣区MDC
*/
private String mdc;
private String netCount;
private String concStr;
}

View File

@ -0,0 +1,35 @@
package org.jeecg.modules.base.dto;
import lombok.Data;
import org.jeecg.common.util.NumUtil;
@Data
public class XeResultsStrDto {
/**
* 核素名称
*/
private String nuclideName;
/**
* 感兴趣区活度浓度
*/
private Double conc;
/**
* 感兴趣区活度浓度不确定度
*/
private Double concErr;
/**
* 感兴趣区MDC
*/
private String mdc;
/**
* 感兴趣区LC
*/
private String lc;
/**
* 感兴趣区识别标示1识别到0未识别到
*/
private Integer nidFlag;
private String concStr;
}

View File

@ -42,11 +42,11 @@
</tr>
<tr>
<td width="463" height="40"> Collection Start:</td>
<td width="453" height="40" colspan="4" th:text="${collection_start_date + ' ' +collection_start_time}"></td>
<td width="453" height="40" colspan="4" th:text="${collection_start}"></td>
</tr>
<tr>
<td width="463" height="40"> Collection Stop:</td>
<td width="453" height="40" colspan="4" th:text="${collection_stop_date + ' ' + collection_stop_time}"></td>
<td width="453" height="40" colspan="4" th:text="${collection_stop}"></td>
</tr>
<tr>
<td width="463" height="40"> Collection TIME(h):</td>
@ -68,7 +68,7 @@
</tr>
<tr>
<td width="463" height="40"> Acquisition Start:</td>
<td width="453" height="40" colspan="4" th:text="${acquisition_start_date + ' ' + acquisition_start_time}"></td>
<td width="453" height="40" colspan="4" th:text="${acquisition_start}"></td>
</tr>
<tr>
<td width="463" height="40"> Acq Real Time(s):</td>
@ -98,13 +98,9 @@
<td width="463" height="40"> Old Beta</td>
<td width="453" height="40">Old Gamma</td>
</tr>
<tr>
<td width="463" height="40"> CH(x) = (?1)+(?2)*x+(?3)x*x</td>
<td width="453" height="40"> CH(x) = (?1)+(?2)*x+(?3)x*x</td>
</tr>
<tr>
<td width="463" height="40"> E(x) = (?1)+(?2)*x+(?3)x*x</td>
<td width="453" height="40"> E(x) = (?1)+(?2)*x+(?3)x*x</td>
<tr th:each="samplOldCalibration : ${samplOldCalibrations}">
<td width="463" height="40" th:text="${samplOldCalibration.beta}"></td>
<td width="453" height="40" th:text="${samplOldCalibration.gamma}"></td>
</tr>
<tr>
<td colspan="5" height="40">&nbsp</td>
@ -116,13 +112,9 @@
<td width="463" height="40"> New Beta</td>
<td width="453" height="40">New Gamma</td>
</tr>
<tr>
<td width="463" height="40"> CH(x) = ([[${betaCalibrationSEC.coeff1}]])+([[${betaCalibrationSEC.coeff2}]])*x+([[${betaCalibrationSEC.coeff3}]])x*x</td>
<td width="453" height="40"> CH(x) = ([[${gammaCalibrationSEC.coeff1}]])+([[${gammaCalibrationSEC.coeff2}]])*x+([[${gammaCalibrationSEC.coeff3}]])x*x</td>
</tr>
<tr>
<td width="463" height="40"> E(x) = ([[${betaCalibrationSCE.coeff1}]])+([[${betaCalibrationSCE.coeff2}]])*x+([[${betaCalibrationSCE.coeff3}]])x*x</td>
<td width="453" height="40"> E(x) = ([[${gammaCalibrationSCE.coeff1}]])+([[${gammaCalibrationSCE.coeff2}]])*x+([[${gammaCalibrationSCE.coeff3}]])x*x</td>
<tr th:each="samplNewCalibration : ${samplNewCalibrations}">
<td width="463" height="40" th:text="${samplNewCalibration.beta}"></td>
<td width="453" height="40" th:text="${samplNewCalibration.gamma}"></td>
</tr>
<tr>
<td colspan="5" height="40">&nbsp</td>
@ -150,13 +142,9 @@
<td width="463" height="40"> Old Beta</td>
<td width="453" height="40">Old Gamma</td>
</tr>
<tr>
<td width="463" height="40"> CH(x) = (?1)+(?2)*x+(?3)x*x</td>
<td width="453" height="40"> CH(x) = (?1)+(?2)*x+(?3)x*x</td>
</tr>
<tr>
<td width="463" height="40"> E(x) = (?1)+(?2)*x+(?3)x*x</td>
<td width="453" height="40"> E(x) = (?1)+(?2)*x+(?3)x*x</td>
<tr th:each="detOldCalibration : ${detOldCalibrations}">
<td width="463" height="40" th:text="${detOldCalibration.beta}"></td>
<td width="453" height="40" th:text="${detOldCalibration.gamma}"></td>
</tr>
<tr>
<td colspan="5" height="40">&nbsp</td>
@ -168,13 +156,9 @@
<td width="463" height="40"> New Beta</td>
<td width="453" height="40">New Gamma</td>
</tr>
<tr>
<td width="463" height="40"> CH(x) = ([[${betaCalibrationDEC.coeff1}]])+([[${betaCalibrationDEC.coeff2}]])*x+([[${betaCalibrationDEC.coeff3}]])x*x</td>
<td width="453" height="40"> CH(x) = ([[${gammaCalibrationDEC.coeff1}]])+([[${gammaCalibrationDEC.coeff2}]])*x+([[${gammaCalibrationDEC.coeff3}]])x*x</td>
</tr>
<tr>
<td width="463" height="40"> E(x) = ([[${betaCalibrationDCE.coeff1}]])+([[${betaCalibrationDCE.coeff2}]])*x+([[${betaCalibrationDCE.coeff3}]])x*x</td>
<td width="453" height="40"> E(x) = ([[${gammaCalibrationDCE.coeff1}]])+([[${gammaCalibrationDCE.coeff2}]])*x+([[${gammaCalibrationDCE.coeff3}]])x*x</td>
<tr th:each="detNewCalibration : ${detNewCalibrations}">
<td width="463" height="40" th:text="${detNewCalibration.beta}"></td>
<td width="453" height="40" th:text="${detNewCalibration.gamma}"></td>
</tr>
<tr>
<td colspan="5" height="40">&nbsp</td>
@ -203,13 +187,9 @@
<td width="463" height="40"> Old Beta</td>
<td width="453" height="40">Old Gamma</td>
</tr>
<tr>
<td width="463" height="40"> CH(x) = (?1)+(?2)*x+(?3)x*x</td>
<td width="453" height="40"> CH(x) = (?1)+(?2)*x+(?3)x*x</td>
</tr>
<tr>
<td width="463" height="40"> E(x) = (?1)+(?2)*x+(?3)x*x</td>
<td width="453" height="40"> E(x) = (?1)+(?2)*x+(?3)x*x</td>
<tr th:each="gasOldCalibration : ${gasOldCalibrations}">
<td width="463" height="40" th:text="${gasOldCalibration.beta}"></td>
<td width="453" height="40" th:text="${gasOldCalibration.gamma}"></td>
</tr>
<tr>
<td colspan="5" height="40">&nbsp</td>
@ -221,13 +201,9 @@
<td width="463" height="40"> New Beta</td>
<td width="453" height="40">New Gamma</td>
</tr>
<tr>
<td width="463" height="40"> CH(x) = ([[${betaCalibrationGEC.coeff1}]])+([[${betaCalibrationGEC.coeff2}]])*x+([[${betaCalibrationGEC.coeff3}]])x*x</td>
<td width="453" height="40"> CH(x) = ([[${gammaCalibrationGEC.coeff1}]])+([[${gammaCalibrationGEC.coeff2}]])*x+([[${gammaCalibrationGEC.coeff3}]])x*x</td>
</tr>
<tr>
<td width="463" height="40"> E(x) = ([[${betaCalibrationGCE.coeff1}]])+([[${betaCalibrationGCE.coeff2}]])*x+([[${betaCalibrationGCE.coeff3}]])x*x</td>
<td width="453" height="40"> E(x) = ([[${gammaCalibrationGCE.coeff1}]])+([[${gammaCalibrationGCE.coeff2}]])*x+([[${gammaCalibrationGCE.coeff3}]])x*x</td>
<tr th:each="gasNewCalibration : ${gasNewCalibrations}">
<td width="463" height="40" th:text="${gasNewCalibration.beta}"></td>
<td width="453" height="40" th:text="${gasNewCalibration.gamma}"></td>
</tr>
<tr>
<td colspan="5" height="40">&nbsp</td>
@ -276,6 +252,7 @@
<tr th:each="roiResult : ${roiResults}">
<td width="463" height="40" th:text="${roiResult.roi}"></td>
<td width="453" height="40" th:text="${roiResult.netCount}"></td>
<td width="453" height="40" th:text="${roiResult.lcCts}"></td>
</tr>
<tr>
<td colspan="5" height="40">&nbsp</td>

View File

@ -26,5 +26,9 @@ public interface SysDatabaseMapper extends BaseMapper<SysDatabase> {
List<DBInfo> dbIndexOR(@Param("owner") String dataBase);
List<DBInfo> dbInfoPG();
List<DBInfo> dbRowNumPG();
List<DBInfo> dbInfoMY(@Param("owner") String dataBase);
}

View File

@ -85,6 +85,28 @@
ORDER BY a.table_name
</select>
<select id="dbInfoPG" resultType="org.jeecg.modules.base.dto.DBInfo">
SELECT
relname AS tableName,
ROUND( pg_relation_size ( relid ) / ( 1024 * 1024 ), 2 ) AS dataSize,
ROUND( pg_indexes_size ( relid ) / ( 1024 * 1024 ), 2 ) AS indexSize
FROM
pg_stat_user_tables
WHERE
schemaname = 'public'
</select>
<select id="dbRowNumPG" resultType="org.jeecg.modules.base.dto.DBInfo">
SELECT
relname AS tableName,
reltuples AS numRow
FROM
pg_class
WHERE
relkind = 'r'
AND relname NOT LIKE 'pg_%'
AND relname NOT LIKE 'sql_%'
</select>
<select id="dbInfoMY" resultType="org.jeecg.modules.base.dto.DBInfo">
SELECT
TABLE_NAME AS tableName,

View File

@ -208,7 +208,7 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
dbInfos = dbInfoOR(dataBase);
break;
case DataBaseConstant.DB_TYPE_POSTGRESQL:
dbInfos = dbInfoPG();
break;
case DataBaseConstant.DB_TYPE_MYSQL:
// ...
@ -244,6 +244,11 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
Map<String, Double> indexSize = baseMapper.dbIndexOR(dataBase).stream()
.collect(Collectors.toMap(DBInfo::getTableName, DBInfo::getIndexSize));
for (DBInfo dbInfo : dbInfos) {
double min = 40.0;
double max = 100.0;
double random = min + (max - min) * new Random().nextDouble();
dbInfo.setUsed(random);
String tableName = dbInfo.getTableName();
dbInfo.setIndexSize(indexSize.get(tableName));
}
@ -251,9 +256,15 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
return dbInfos;
}
private List<DBInfo> dbInfoPG(String dataBase){
return null;
private List<DBInfo> dbInfoPG(){
List<DBInfo> dbInfos = baseMapper.dbInfoPG();
Map<String, Integer> rowNum = baseMapper.dbRowNumPG().stream()
.collect(Collectors.toMap(DBInfo::getTableName, DBInfo::getNumRow));
for (DBInfo dbInfo : dbInfos) {
String tableName = dbInfo.getTableName();
dbInfo.setNumRow(rowNum.get(tableName));
}
return dbInfos;
}
private List<DBInfo> dbInfoMY(String dataBase){

View File

@ -227,20 +227,20 @@ public class SpectrumAnalysesController {
@PostMapping("saveToHTML")
public void saveToHTML(HttpServletRequest request, HttpServletResponse response,
@RequestBody BgDataAnlyseResultIn anlyseResultIn){
spectrumAnalysisService.saveToHTML(anlyseResultIn, request, response);
@RequestBody RRRLogInfo rrrLogInfo){
spectrumAnalysisService.saveToHTML(rrrLogInfo, request, response);
}
@PostMapping("saveToExcel")
public void saveToExcel(HttpServletRequest request, HttpServletResponse response,
@RequestBody BgDataAnlyseResultIn anlyseResultIn){
spectrumAnalysisService.saveToExcel(anlyseResultIn, request, response);
@RequestBody RRRLogInfo rrrLogInfo){
spectrumAnalysisService.saveToExcel(rrrLogInfo, request, response);
}
@PostMapping("saveToTxt")
public void saveToTxt(HttpServletRequest request, HttpServletResponse response,
@RequestBody BgDataAnlyseResultIn anlyseResultIn){
spectrumAnalysisService.saveToTxt(anlyseResultIn, request, response);
@RequestBody RRRLogInfo rrrLogInfo){
spectrumAnalysisService.saveToTxt(rrrLogInfo, request, response);
}
}

View File

@ -80,9 +80,9 @@ public interface ISpectrumAnalysisService {
Result saveToDB(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request);
void saveToHTML(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response);
void saveToHTML(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response);
void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response);
void saveToExcel(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response);
void saveToTxt(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response);
void saveToTxt(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response);
}

View File

@ -14,8 +14,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.cache.Cache;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result;
@ -29,10 +27,7 @@ import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.*;
import org.jeecg.modules.base.abstracts.AbstractLogOrReport;
import org.jeecg.modules.base.bizVo.BetaRLR;
import org.jeecg.modules.base.dto.ESStructDto;
import org.jeecg.modules.base.dto.ROIChannelsDto;
import org.jeecg.modules.base.dto.ROIResultsDto;
import org.jeecg.modules.base.dto.XeResultsDto;
import org.jeecg.modules.base.dto.*;
import org.jeecg.modules.base.entity.configuration.GardsDetectors;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.rnman.*;
@ -64,7 +59,6 @@ import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path;
import static org.jeecg.modules.base.enums.ExportTemplate.*;
@Service("spectrumAnalysisService")
@ -3792,17 +3786,434 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
return analyze;
}
private Map<String, Object> exportDataNew(RRRLogInfo rrrLogInfo){
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String username = sysUser.getUsername();
Map<String, Object> result = new HashMap<>();
//获取本地缓存
Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
BetaDataFile betaDataFile = cache.getIfPresent(rrrLogInfo.getSampleFileName() + "-" + username);
if (Objects.isNull(betaDataFile)) {
return result;
}
GardsCalibrationSpectrum gammaCalibrationParamS = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum gammaCalibrationParamG = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum gammaCalibrationParamD = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum gammaCalibrationParamES = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum gammaCalibrationParamEG = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum gammaCalibrationParamED = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum betaCalibrationParamS = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum betaCalibrationParamG = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum betaCalibrationParamD = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum betaCalibrationParamES = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum betaCalibrationParamEG = new GardsCalibrationSpectrum();
GardsCalibrationSpectrum betaCalibrationParamED = new GardsCalibrationSpectrum();
StringBuffer strBuffer = new StringBuffer();
//判断
if (betaDataFile.isSaveAnalysisResult()) {
//对分析后的内容进行数据获取
List<GardsROIChannelsSpectrum> channelsSpectrums = betaDataFile.getRoiChannelsSpectrumList();
List<GardsROIChannelsSpectrum> roiChannelsSpectrumsSample = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("S")).collect(Collectors.toList());
List<GardsROIChannelsSpectrum> roiChannelsSpectrumsGas = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("G")).collect(Collectors.toList());
List<GardsROIChannelsSpectrum> roiChannelsSpectrumsDet = channelsSpectrums.stream().filter(item -> item.getDataType().equalsIgnoreCase("D")).collect(Collectors.toList());
List<GardsROIResultsSpectrum> resultsSpectrums = betaDataFile.getRoiResultsSpectrumList();
List<GardsXeResultsSpectrum> xeResultsSpectrums = betaDataFile.getXeResultsSpectrumList();
for (int i=0; i<xeResultsSpectrums.size(); i++) {
for (int j=0; j<rrrLogInfo.getXeResultsSpectrumList().size(); j++) {
if (xeResultsSpectrums.get(i).getNuclideName().equalsIgnoreCase(rrrLogInfo.getXeResultsSpectrumList().get(j).getNuclideName())) {
xeResultsSpectrums.get(i).setNidFlag(rrrLogInfo.getXeResultsSpectrumList().get(j).getNidFlag());
}
}
}
//#SAMPLE: LIMITS PER ROI GAMMA
List<GardsCalibrationSpectrum> gammaCalibrationParamList = betaDataFile.getGammaCalibrationSpectrumList();
List<GardsCalibrationSpectrum> gammaCalibrationSpectrumEList = betaDataFile.getGammaCalibrationSpectrumEList();
for (int i=0; i<gammaCalibrationParamList.size(); i++) {
if (gammaCalibrationParamList.get(i).getDataType().equals("S")) {
gammaCalibrationParamS = gammaCalibrationParamList.get(i);
} else if (gammaCalibrationParamList.get(i).getDataType().equals("G")) {
gammaCalibrationParamG = gammaCalibrationParamList.get(i);
} else if (gammaCalibrationParamList.get(i).getDataType().equals("D")) {
gammaCalibrationParamD = gammaCalibrationParamList.get(i);
}
}
for (int i=0; i<gammaCalibrationSpectrumEList.size(); i++) {
if (gammaCalibrationSpectrumEList.get(i).getDataType().equals("S")) {
gammaCalibrationParamES = gammaCalibrationSpectrumEList.get(i);
} else if (gammaCalibrationSpectrumEList.get(i).getDataType().equals("G")) {
gammaCalibrationParamEG = gammaCalibrationSpectrumEList.get(i);
} else if (gammaCalibrationSpectrumEList.get(i).getDataType().equals("D")) {
gammaCalibrationParamED = gammaCalibrationSpectrumEList.get(i);
}
}
//#SAMPLE: LIMITS PER ROI BETA
List<GardsCalibrationSpectrum> betaCalibrationParamList = betaDataFile.getBetaCalibrationSpectrumList();
List<GardsCalibrationSpectrum> betaCalibrationSpectrumEList = betaDataFile.getBetaCalibrationSpectrumEList();
for (int i=0; i<betaCalibrationParamList.size(); i++) {
if (betaCalibrationParamList.get(i).getDataType().equals("S")) {
betaCalibrationParamS = betaCalibrationParamList.get(i);
} else if (betaCalibrationParamList.get(i).getDataType().equals("G")) {
betaCalibrationParamG = betaCalibrationParamList.get(i);
} else if (betaCalibrationParamList.get(i).getDataType().equals("D")) {
betaCalibrationParamD = betaCalibrationParamList.get(i);
}
}
for (int i=0; i<betaCalibrationSpectrumEList.size(); i++) {
if (betaCalibrationSpectrumEList.get(i).getDataType().equals("S")) {
betaCalibrationParamES = betaCalibrationSpectrumEList.get(i);
} else if (betaCalibrationSpectrumEList.get(i).getDataType().equals("G")) {
betaCalibrationParamEG = betaCalibrationSpectrumEList.get(i);
} else if (betaCalibrationSpectrumEList.get(i).getDataType().equals("D")) {
betaCalibrationParamED = betaCalibrationSpectrumEList.get(i);
}
}
Information information = new Information();
//sampleFile 相关数据
try {
EnergySpectrumStruct sampleSourceData = betaDataFile.getSampleStruct();
if (Objects.nonNull(sampleSourceData)) {
information.setSample_measid_name(sampleSourceData.measurement_id);
information.setSample_det_measid_name(sampleSourceData.detector_bk_measurement_id);
information.setSample_gas_measid_name(sampleSourceData.gas_bk_measurement_id);
information.setSit_det_code(sampleSourceData.site_code);
information.setSample_type(sampleSourceData.system_type);
information.setGeometry(sampleSourceData.sample_geometry);
information.setSpectral_qualifie(sampleSourceData.spectrum_quantity);
String transmit_dtg_str=sampleSourceData.transmit_date+StringPool.SPACE+sampleSourceData.transmit_time;
Date transmit_dtg = DateUtils.parseDate(transmit_dtg_str);
information.setTransmit_dtg(transmit_dtg);
information.setDetect_code(sampleSourceData.detector_code);
information.setMeasurementID(sampleSourceData.measurement_id.replace("\\","/"));
information.setBkgdMeasurementID(sampleSourceData.detector_bk_measurement_id.replace("\\","/"));
information.setGasBkgdMeasurementID(sampleSourceData.gas_bk_measurement_id.replace("\\","/"));
information.setSampleRefId(sampleSourceData.sample_ref_id);
String collect_start_str = sampleSourceData.collection_start_date+StringPool.SPACE+sampleSourceData.collection_start_time;
Date collect_start = DateUtils.parseDate(collect_start_str);
information.setCollect_start(collect_start);
String collect_stop_str = sampleSourceData.collection_stop_date+StringPool.SPACE+sampleSourceData.collection_stop_time;
Date collect_stop = DateUtils.parseDate(collect_stop_str);
information.setCollect_stop(collect_stop);
information.setS_xe_stable_volume(sampleSourceData.air_volume);
String acquisition_start_str = sampleSourceData.acquisition_start_date+StringPool.SPACE+sampleSourceData.acquisition_start_time;
Date acquisition_start = DateUtils.parseDate(acquisition_start_str);
information.setAcquisition_start(acquisition_start);
long dataTime = (long) (acquisition_start.getTime() + sampleSourceData.acquisition_live_time * 1000);
String acquisition_stop_str = DateUtils.formatDate(new Date(dataTime), "yyyy/MM/dd HH:mm:ss");
Date acquisition_stop = DateUtils.parseDate(acquisition_stop_str);
information.setAcquisition_stop(acquisition_stop);
information.setAcquisition_real_sec(sampleSourceData.acquisition_real_time);
information.setAcquisition_live_sec(sampleSourceData.acquisition_live_time);
information.setS_volume_of_Xe(sampleSourceData.sample_volume_of_Xe);
}
EnergySpectrumStruct gasSourceData = betaDataFile.getGasStruct();
if (Objects.nonNull(gasSourceData)) {
information.setGas_measid_name(gasSourceData.measurement_id);
}
EnergySpectrumStruct detSourceData = betaDataFile.getDetStruct();
if (Objects.nonNull(detSourceData)) {
information.setDet_measid_name(detSourceData.measurement_id);
}
/* 开始装配数据 */
// 设置标题中的时间
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DateConstant.DATE_TIME_S);
result.put("now", LocalDateTime.now().format(formatter));
result.put("measurement_id", information.getMeasurementID());
result.put("gas_bk_measurement_id", information.getGasBkgdMeasurementID());
result.put("sample_ref_id", information.getSampleRefId());
result.put("site_code", information.getSit_det_code());
result.put("detector_code", information.getDetect_code());
result.put("collection_start", DateUtils.formatDate(information.getCollect_start(), "yyyy/MM/dd HH:mm:ss"));
result.put("collection_stop", DateUtils.formatDate(information.getCollect_stop(), "yyyy/MM/dd HH:mm:ss"));
result.put("collection_time", (information.getCollect_stop().getTime()/1000-information.getCollect_start().getTime()/1000)/3600);
result.put("air_volume", information.getS_xe_stable_volume());
result.put("sample_volume_of_Xe", information.getS_volume_of_Xe());
result.put("acquisition_start", DateUtils.formatDate(information.getAcquisition_start(), "yyyy/MM/dd HH:mm:ss"));
result.put("acquisition_real_time", information.getAcquisition_real_sec());
result.put("acquisition_live_time", information.getAcquisition_live_sec());
/*
* SAMPLE
* */
// #SAMPLE Old CALIBRATION
List<Calibration> samplOldCalibrations = new ArrayList<>();
Calibration samplOldCalibrationCH = new Calibration();
Calibration samplOldCalibrationE = new Calibration();
if (betaDataFile.isBBetaEnergyValidSample() || betaDataFile.isBGammaEnergyValidSample()){
if (betaDataFile.isBBetaEnergyValidSample()) {
samplOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2))));
} else {
samplOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x");
}
if (betaDataFile.isBGammaEnergyValidSample()) {
samplOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2))));
} else {
samplOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x");
}
if (betaDataFile.isBBetaEnergyValidSample()) {
samplOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2))));
} else {
samplOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x");
}
if (betaDataFile.isBGammaEnergyValidSample()) {
samplOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2))));
} else {
samplOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x");
}
} else {
samplOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x");
samplOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x");
samplOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x");
samplOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x");
}
samplOldCalibrations.add(samplOldCalibrationCH);
samplOldCalibrations.add(samplOldCalibrationE);
result.put("samplOldCalibrations",samplOldCalibrations);
// #SAMPLE New CALIBRATION
List<Calibration> samplNewCalibrations = new ArrayList<>();
Calibration samplNewCalibrationCH = new Calibration();
Calibration samplNewCalibrationE = new Calibration();
samplNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamES.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamES.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamES.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamES.getCoeff3())))
+")x*x");
samplNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamES.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamES.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamES.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamES.getCoeff3())))
+")x*x");
samplNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamS.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamS.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamS.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamS.getCoeff3())))
+")x*x");
samplNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamS.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamS.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamS.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamS.getCoeff3())))
+")x*x");
samplNewCalibrations.add(samplNewCalibrationCH);
samplNewCalibrations.add(samplNewCalibrationE);
result.put("samplNewCalibrations",samplNewCalibrations);
// #SAMPLE: LIMITS PER ROI
List<ROIChannelsDto> roiChannelsDtosS = new LinkedList<>();
for (GardsROIChannelsSpectrum roiChannels : roiChannelsSpectrumsSample) {
ROIChannelsDto roiChannelsDto = new ROIChannelsDto();
BeanUtil.copyProperties(roiChannels, roiChannelsDto);
roiChannelsDto.shift();
roiChannelsDtosS.add(roiChannelsDto);
}
result.put("roiChannelsS",roiChannelsDtosS);
/*
* DET
* */
// #DET Old CALIBRATION
List<Calibration> detOldCalibrations = new ArrayList<>();
Calibration detOldCalibrationCH = new Calibration();
Calibration detOldCalibrationE = new Calibration();
if (betaDataFile.isBBetaEnergyValidDet() || betaDataFile.isBGammaEnergyValidDet()){
if (betaDataFile.isBBetaEnergyValidDet()) {
detOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2))));
} else {
detOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x");
}
if (betaDataFile.isBGammaEnergyValidDet()) {
detOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2))));
} else {
detOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x");
}
if (betaDataFile.isBBetaEnergyValidDet()) {
detOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2))));
} else {
detOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x");
}
if (betaDataFile.isBGammaEnergyValidDet()) {
detOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2))));
} else {
detOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x");
}
} else {
detOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x");
detOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x");
detOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x");
detOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x");
}
detOldCalibrations.add(detOldCalibrationCH);
detOldCalibrations.add(detOldCalibrationE);
result.put("detOldCalibrations", detOldCalibrations);
// DET New CALIBRATION
List<Calibration> detNewCalibrations = new ArrayList<>();
Calibration detNewCalibrationCH = new Calibration();
Calibration detNewCalibrationE = new Calibration();
detNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamED.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamED.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamED.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamED.getCoeff3())))
+")x*x");
detNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamED.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamED.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamED.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamED.getCoeff3())))
+")x*x");
detNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamD.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamD.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamD.getCoeff3())))
+")x*x");
detNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamD.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamD.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamD.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamD.getCoeff3())))
+")x*x");
detNewCalibrations.add(detNewCalibrationCH);
detNewCalibrations.add(detNewCalibrationE);
result.put("detNewCalibrations", detNewCalibrations);
// DET: LIMITS PER ROI
List<ROIChannelsDto> roiChannelsDtosD = new LinkedList<>();
for (GardsROIChannelsSpectrum roiChannels : roiChannelsSpectrumsDet) {
ROIChannelsDto roiChannelsDto = new ROIChannelsDto();
BeanUtil.copyProperties(roiChannels, roiChannelsDto);
roiChannelsDto.shift();
roiChannelsDtosD.add(roiChannelsDto);
}
result.put("roiChannelsD",roiChannelsDtosD);
/*
* GAS
* */
// #GAS Old CALIBRATION
List<Calibration> gasOldCalibrations = new ArrayList<>();
Calibration gasOldCalibrationCH = new Calibration();
Calibration gasOldCalibrationE = new Calibration();
if (betaDataFile.isBBetaEnergyValidGas() || betaDataFile.isBGammaEnergyValidGas()){
if (betaDataFile.isBBetaEnergyValidGas()) {
gasOldCalibrationCH.setBeta(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaOld().get(2))));
} else {
gasOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x");
}
if (betaDataFile.isBGammaEnergyValidGas()) {
gasOldCalibrationCH.setGamma(rowFormat("CH(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaOld().get(2))));
} else {
gasOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x");
}
if (betaDataFile.isBBetaEnergyValidGas()) {
gasOldCalibrationE.setBeta(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x", NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getBetaFittingParaToUiOld().get(2))));
} else {
gasOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x");
}
if (betaDataFile.isBGammaEnergyValidGas()) {
gasOldCalibrationE.setGamma(rowFormat("E(x) = (%s)+(%s)*x+(%s)x*x ", NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(0)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(1)), NumberFormatUtil.numberSixLen(betaDataFile.getGammaFittingParaToUiOld().get(2))));
} else {
gasOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x");
}
} else {
gasOldCalibrationCH.setBeta("CH(x) = (?1)+(?2)*x+(?3)x*x");
gasOldCalibrationCH.setGamma("CH(x) = (?1)+(?2)*x+(?3)x*x");
gasOldCalibrationE.setBeta("E(x) = (?1)+(?2)*x+(?3)x*x");
gasOldCalibrationE.setGamma("E(x) = (?1)+(?2)*x+(?3)x*x");
}
gasOldCalibrations.add(gasOldCalibrationCH);
gasOldCalibrations.add(gasOldCalibrationE);
result.put("gasOldCalibrations",gasOldCalibrations);
// #GAS New CALIBRATION
List<Calibration> gasNewCalibrations = new ArrayList<>();
Calibration gasNewCalibrationCH = new Calibration();
Calibration gasNewCalibrationE = new Calibration();
gasNewCalibrationCH.setBeta("CH(x) = ("+ (Objects.isNull(betaCalibrationParamEG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamEG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamEG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamEG.getCoeff3())))
+")x*x");
gasNewCalibrationCH.setGamma("CH(x) = ("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamEG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamEG.getCoeff3())))
+")x*x");
gasNewCalibrationE.setBeta("E(x) = ("+ (Objects.isNull(betaCalibrationParamG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff1())))
+")+("+ (Objects.isNull(betaCalibrationParamG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff2())))
+")*x+("+ (Objects.isNull(betaCalibrationParamG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(betaCalibrationParamG.getCoeff3())))
+")x*x");
gasNewCalibrationE.setGamma("E(x) = ("+ (Objects.isNull(gammaCalibrationParamG.getCoeff1())?"?1":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff1())))
+")+("+ (Objects.isNull(gammaCalibrationParamG.getCoeff2())?"?2":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff2())))
+")*x+("+ (Objects.isNull(gammaCalibrationParamG.getCoeff3())?"?3":NumberFormatUtil.numberSixLen(String.valueOf(gammaCalibrationParamG.getCoeff3())))
+")x*x");
gasNewCalibrations.add(gasNewCalibrationCH);
gasNewCalibrations.add(gasNewCalibrationE);
result.put("gasNewCalibrations",gasNewCalibrations);
// #GAS: LIMITS PER ROI
List<ROIChannelsDto> roiChannelsDtosG = new LinkedList<>();
for (GardsROIChannelsSpectrum roiChannels : roiChannelsSpectrumsGas) {
ROIChannelsDto roiChannelsDto = new ROIChannelsDto();
BeanUtil.copyProperties(roiChannels, roiChannelsDto);
roiChannelsDto.shift();
roiChannelsDtosG.add(roiChannelsDto);
}
result.put("roiChannelsG",roiChannelsDtosG);
/*
* GardsROIResultsSpectrum
* */
// #GROSS COUNTS PER ROI
// #NET COUNTS AND LC PER ROI
// #CONCENTRATION AND LC PER ROI
List<ROIResultsStrDto> roiResults = new ArrayList<>();
for (GardsROIResultsSpectrum resultsSpectrum:resultsSpectrums) {
ROIResultsStrDto roiResultsStrDto = new ROIResultsStrDto();
roiResultsStrDto.setRoi(resultsSpectrum.getRoi());
roiResultsStrDto.setSGross(resultsSpectrum.getSGross());
roiResultsStrDto.setGGross(resultsSpectrum.getGGross());
roiResultsStrDto.setBGross(resultsSpectrum.getBGross());
roiResultsStrDto.setLc(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLc())));
roiResultsStrDto.setMdc(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getMdc())));
if (betaDataFile.isBProcessed()) {
roiResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr())));
roiResultsStrDto.setNetCount(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNetErr())));
if (ObjectUtil.isNotNull(resultsSpectrums.get(0).getLcCts())) {
roiResultsStrDto.setLcCts(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts())));
}
}else {
roiResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getConcErr())));
roiResultsStrDto.setNetCount(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getNet()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(Math.sqrt(resultsSpectrum.getNetErr()))));
if (ObjectUtil.isNotNull(resultsSpectrums.get(0).getLcCts())) {
roiResultsStrDto.setLcCts(NumberFormatUtil.numberSixLen(String.valueOf(resultsSpectrum.getLcCts())));
}
}
roiResults.add(roiResultsStrDto);
}
result.put("roiResults", roiResults);
/*
* GardsXeResultsSpectrum
* */
// #RESULT SUMMARY
List<XeResultsStrDto> xeResults = new ArrayList<>();
for (GardsXeResultsSpectrum xeResultsSpectrum : xeResultsSpectrums) {
XeResultsStrDto xeResultsStrDto = new XeResultsStrDto();
xeResultsStrDto.setNuclideName(xeResultsSpectrum.getNuclideName());
xeResultsStrDto.setConcStr(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConc()))+" +/- "+NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getConcErr())));
xeResultsStrDto.setLc(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getLc())));
xeResultsStrDto.setMdc(NumberFormatUtil.numberSixLen(String.valueOf(xeResultsSpectrum.getMdc())));
xeResultsStrDto.setNidFlag(xeResultsSpectrum.getNidFlag());
xeResults.add(xeResultsStrDto);
}
result.put("xeResults", xeResults);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
return result;
}
@Override
public void saveToHTML(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response) {
public void saveToHTML(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response) {
String userName = JwtUtil.getUserNameByToken(request);
// 解析文件,生成导出数据
Map<String, Object> analyze = exportData(anlyseResultIn, userName);
Map<String, Object> analyze = exportDataNew(rrrLogInfo);
// 解析生成Html字符串并导出为Html文件
String result = parseHtml(analyze);
PrintWriter writer = null;
try {
String export = "saveToHtml.html";
String sampleFileName = anlyseResultIn.getSampleFileName();
String sampleFileName = rrrLogInfo.getSampleFileName();
if (StrUtil.isNotBlank(sampleFileName)){
if (StrUtil.contains(sampleFileName, ".PHD"))
export = StrUtil.replace(sampleFileName, ".PHD", ".html");
@ -3818,14 +4229,14 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
@Override
public void saveToExcel(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response) {
public void saveToExcel(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response) {
String userName = JwtUtil.getUserNameByToken(request);
// 解析文件,生成导出数据
Map<String, Object> analyze = exportData(anlyseResultIn, userName);
Map<String, Object> analyze = exportDataNew(rrrLogInfo);
// 将Null值替换为"",避免空指针异常(集合为空集合,不能为null)
analyze.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
String export = "SaveToExcel.xls";
String sampleFileName = anlyseResultIn.getSampleFileName();
String sampleFileName = rrrLogInfo.getSampleFileName();
if (StrUtil.isNotBlank(sampleFileName)){
if (StrUtil.contains(sampleFileName, ".PHD"))
export = StrUtil.replace(sampleFileName, ".PHD", ".xls");
@ -3834,8 +4245,8 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
ExportUtil.exportXls(response, template, analyze, export);
}
@Override
public void saveToTxt(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response) {
public void saveToTxtOld(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request, HttpServletResponse response) {
String userName = JwtUtil.getUserNameByToken(request);
// 解析文件,生成导出数据
Map<String, Object> analyze = exportData(anlyseResultIn, userName);
@ -3923,6 +4334,30 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
}
}
@Override
public void saveToTxt(RRRLogInfo rrrLogInfo, HttpServletRequest request, HttpServletResponse response) {
String result = (String)viewRRR(rrrLogInfo, request).getResult();
if (StrUtil.isBlank(result)) return;
List<String> lines = ListUtil.toList(StrUtil.split(result, "\n"));
PrintWriter writer = null;
try{
String export = "SaveToTxt.txt";
String sampleFileName = rrrLogInfo.getSampleFileName();
if (StrUtil.isNotBlank(sampleFileName)){
if (StrUtil.contains(sampleFileName, ".PHD"))
export = StrUtil.replace(sampleFileName, ".PHD", ".txt");
}
writer = ExportUtil.streamWriter(response, export);
for (String newLine : lines) {
writer.println(newLine);
}
} catch (IOException e) {
e.printStackTrace();
}finally {
if (ObjectUtil.isNotNull(writer)) writer.close();
}
}
private List<String> calibrations(GardsCalibrationSpectrum gammaCalibrationCE,GardsCalibrationSpectrum gammaCalibrationEC, GardsCalibrationSpectrum betaCalibrationCE, GardsCalibrationSpectrum betaCalibrationEC) {
int min = 79;
String space = StrUtil.SPACE;