修改自动分析和交互分析样品等级,计算阈值相关服务
This commit is contained in:
parent
3a59339773
commit
d8c981c2f4
|
@ -35,10 +35,11 @@ public class GardsAnalysesServiceImpl extends ServiceImpl<GardsAnalysesMapper, G
|
|||
* @param endDate 分析结束时间
|
||||
* @param logPath
|
||||
* @param reportPath
|
||||
* @param category 分级结果
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public GardsAnalyses create(Integer sampleId, GardsSampleData detSampleData, GardsSampleData gasSampleData, Date beginDate, Date endDate, String logPath, String reportPath) {
|
||||
public GardsAnalyses create(Integer sampleId, GardsSampleData detSampleData, GardsSampleData gasSampleData, Date beginDate, Date endDate, String logPath, String reportPath,Integer category) {
|
||||
GardsAnalyses analyses = new GardsAnalyses();
|
||||
analyses.setSampleId(sampleId);
|
||||
analyses.setAnalysisBegin(beginDate);
|
||||
|
@ -47,7 +48,7 @@ public class GardsAnalysesServiceImpl extends ServiceImpl<GardsAnalysesMapper, G
|
|||
analyses.setSoftware(properties.getSwName());
|
||||
analyses.setSwVersion(properties.getSwVersion());
|
||||
analyses.setAnalyst(properties.getAnalyst());
|
||||
analyses.setCategory(1);//按C++代码写死的1,该字段是分级结果张博士还没有想好数据要不要分级1,2,3,4
|
||||
analyses.setCategory(category);//按C++代码写死的1,该字段是分级结果张博士还没有想好数据要不要分级1,2,3,4
|
||||
analyses.setComments("test");//按C++代码写死的test
|
||||
analyses.setUsedgasphd(gasSampleData.getInputFileName());
|
||||
analyses.setUseddetphd(detSampleData.getInputFileName());
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.google.common.collect.Maps;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.constant.StringConstant;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
|
@ -12,6 +13,7 @@ import org.jeecg.modules.ErrorLogManager;
|
|||
import org.jeecg.modules.base.dto.Info;
|
||||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsAnalyses;
|
||||
import org.jeecg.modules.base.entity.rnauto.GardsThresholdResult;
|
||||
import org.jeecg.modules.base.enums.*;
|
||||
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
||||
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
|
||||
|
@ -23,8 +25,10 @@ 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.jetbrains.annotations.NotNull;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
||||
import java.io.*;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -43,6 +47,8 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
*/
|
||||
private static final String ARR_FILE_SUFFIX = ".txt";
|
||||
private static final String ARR_FILE_NAME_TAIL = "_rpt";
|
||||
//样品级别消费组
|
||||
private final String autoKey = RedisConstant.AUTO_CAT;
|
||||
/**
|
||||
* Sample谱结构体数据
|
||||
*/
|
||||
|
@ -187,6 +193,7 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
|
||||
/**
|
||||
* 查询det、gas数据,sample在构造函数已经传过来
|
||||
*
|
||||
* @throws FileNotExistException
|
||||
*/
|
||||
private void queryPHDFile() throws FileNotExistException {
|
||||
|
@ -232,12 +239,14 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
this.analyseResult = analyseResult;
|
||||
if (Objects.isNull(analyseResult) || !analyseResult.analyse_flag) {
|
||||
ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), analyseResult.error_log, this.phdFileName));
|
||||
throw new BAnalyseException("THE PHD file cannot be parsed:"+this.sampleFileFinalPath+","+this.gasFileFinalPath+","+this.detFileFinalPath);
|
||||
throw new BAnalyseException("THE PHD file cannot be parsed:" + this.sampleFileFinalPath + "," + this.gasFileFinalPath + ","
|
||||
+ this.detFileFinalPath + "analyseResult.analyse_flag:" + analyseResult.analyse_flag + "analyseResult.error_log:" + analyseResult.error_log);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取det和gas谱PHD文件,sample谱PHD文件位置在构造函数已经传过来
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
private void getPHDFile() throws IOException, FileNotExistException {
|
||||
|
@ -293,9 +302,21 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
DataSourceSwitcher.switchToOracle();
|
||||
final TransactionStatus transactionStatus = spectrumServiceQuotes.getTransactionManager().getTransaction(spectrumServiceQuotes.getTransactionDefinition());
|
||||
try {
|
||||
Integer category = 1;
|
||||
try {
|
||||
//TODO 获取样品级别
|
||||
//获取阈值结果
|
||||
List<GardsThresholdResult> thresholds = spectrumServiceQuotes.getGardsThresholdService().findThresholdResults(this.sampleData.getStationId().toString());
|
||||
|
||||
//样品分级
|
||||
category = spectrumServiceQuotes.getSampleGradingService().processAutoTypeB(getSampleInfo(), thresholds);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
|
||||
//存储基础数据
|
||||
this.analyses = spectrumServiceQuotes.getAnalysesService().create(this.sampleData.getSampleId(), this.detSampleData,
|
||||
this.gasSampleData,this.startAnalysisTime,this.endAnalysisTime,logFileRelativePath,arrFileRelativePath);
|
||||
this.gasSampleData, this.startAnalysisTime, this.endAnalysisTime, logFileRelativePath, arrFileRelativePath, category);
|
||||
//调用原始数据dll获取gas、det谱数据入库,sample已有数据直接入库
|
||||
//存储sample谱B_Energy和G_Energy块数据
|
||||
spectrumServiceQuotes.getGardsCalibrationPairsService().createB_EnergyRecord(sampleData.getSampleId(), analyses.getIdAnalysis(), this.sampleStruct);
|
||||
|
@ -332,9 +353,19 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
* 分析成功数据发送到Redis
|
||||
*/
|
||||
private void pushToRedis() {
|
||||
Info info = getSampleInfo();
|
||||
spectrumServiceQuotes.getRedisStreamUtil().pushAnalysis(info);
|
||||
//把分析结果信息存储到redis
|
||||
spectrumServiceQuotes.getRedisStreamUtil().addMessage(autoKey, info);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Info getSampleInfo() {
|
||||
Info info = new Info();
|
||||
info.setStationId(this.sampleData.getStationId().toString());
|
||||
info.setSampleId(this.sampleData.getSampleId().toString());
|
||||
info.setIdAnalysis(this.analyses.getIdAnalysis().toString());
|
||||
info.setSampleType(this.sampleData.getSampleType());
|
||||
info.setSampleName(this.phdFileName);
|
||||
final Instant instant = this.sampleData.getCollectStart().toInstant();
|
||||
final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
|
@ -349,7 +380,7 @@ public class Sample_B_Analysis implements BlockConstant {
|
|||
nuclides.put(XE_135, String.valueOf(analyseResult.Xe135_con));
|
||||
info.setNuclides(nuclides);
|
||||
info.setAnalyst(CommonConstant.REPORT_PREFIX_AUTO);
|
||||
spectrumServiceQuotes.getRedisStreamUtil().pushAnalysis(info);
|
||||
return info;
|
||||
}
|
||||
|
||||
public Sample_B_Analysis.B_AnalysisReport getReport() {
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.jeecg.modules.base.enums.SpectrumType;
|
|||
import org.jeecg.modules.config.datasource.DataSourceSwitcher;
|
||||
import org.jeecg.modules.eneity.event.SpectrumErrorEvent;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.enums.ErrorType;
|
||||
import org.jeecg.modules.exception.AnalySpectrumException;
|
||||
import org.jeecg.modules.exception.GAnalyseException;
|
||||
import org.jeecg.modules.file.FileOperation;
|
||||
|
@ -47,7 +46,6 @@ import javax.xml.parsers.ParserConfigurationException;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
import java.text.ParseException;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -60,7 +58,8 @@ import java.util.*;
|
|||
public class Sample_G_Analysis {
|
||||
|
||||
private final Map<String, String> fieldMap = fieldMap();
|
||||
|
||||
//样品级别消费组
|
||||
private final String autoKey = RedisConstant.AUTO_CAT;
|
||||
private AbstractS_D_Q_G_SpectrumHandler spectrumHandler;
|
||||
|
||||
// Sample谱原始数据
|
||||
|
@ -138,7 +137,7 @@ public class Sample_G_Analysis {
|
|||
/* 准备Gamma分析需要的数据 */
|
||||
GStoreMiddleProcessData middleData = new GStoreMiddleProcessData();
|
||||
Integer sampleId = sampleData.getSampleId();
|
||||
|
||||
middleData.setSample_id(String.valueOf(sampleId));
|
||||
// 获取配置文件
|
||||
GammaFileUtil gammaFileUtil = ApplicationContextUtil.getContext().getBean(GammaFileUtil.class);
|
||||
parameterProperties = ApplicationContextUtil.getContext().getBean(ParameterProperties.class);
|
||||
|
@ -178,6 +177,17 @@ public class Sample_G_Analysis {
|
|||
boolean analyFlag = gammaFileUtil.GetMiddleData(phdFile, CommonConstant.REPORT_PREFIX_AUTO, nuclideLibs, middleData, MiddleDataType.Auto.getType(), "");
|
||||
|
||||
if (analyFlag) {
|
||||
Info info = getSampleInfo(middleData);
|
||||
//TODO 获取样品级别
|
||||
try {
|
||||
//获取阈值结果
|
||||
List<GardsThresholdResult> thresholds = serviceQuotes.getGardsThresholdService().findThresholdResults(this.sampleData.getStationId().toString());
|
||||
//样品分级
|
||||
Integer category = serviceQuotes.getSampleGradingService().processAutoTypeP(info, thresholds);
|
||||
middleData.setAnalyses_category(category);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
// 数据插入数据库
|
||||
this.storageDataToDatabase(phdFile, middleData, phdFile.getQcItems());
|
||||
|
||||
|
@ -193,8 +203,7 @@ public class Sample_G_Analysis {
|
|||
// 保存文件
|
||||
FileOperation.saveOrAppendFile(savePath, reportContent, false);
|
||||
//发送数据到redis
|
||||
middleData.setSample_id(String.valueOf(sampleId));
|
||||
pushToRedis(middleData);
|
||||
pushToRedis(info);
|
||||
} else {
|
||||
ErrorLogManager.getInstance().write(new SpectrumErrorEvent(new Date(), phdFile.getAnalyMessage(), this.sampleFilename));
|
||||
throw new AnalySpectrumException(phdFile.getAnalyMessage());
|
||||
|
@ -213,6 +222,32 @@ public class Sample_G_Analysis {
|
|||
log.info("Gamma自动处理分析--End");
|
||||
}
|
||||
|
||||
private Info getSampleInfo(GStoreMiddleProcessData middleData) {
|
||||
try {
|
||||
Info info = new Info();
|
||||
info.setStationId(this.sampleData.getStationId().toString());
|
||||
info.setSampleId(middleData.sample_id);
|
||||
info.setSampleType(middleData.getSample_Type());
|
||||
info.setIdAnalysis(middleData.getIdAnalysis());
|
||||
info.setSampleName(middleData.analyses_save_filePath.substring(middleData.analyses_save_filePath.lastIndexOf(StringPool.SLASH) + 1));
|
||||
final Instant instant = DateUtils.parseDate(middleData.sample_collection_start).toInstant();
|
||||
final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
info.setCollectionDate(collectTime);
|
||||
info.setDatasource(DSType.ARMDARR.getType());
|
||||
info.setFullOrPrel(this.sampleData.getSpectralQualifie());
|
||||
info.setBetaOrGamma(SpectrumType.GAMMA.getType());
|
||||
Map<String, String> nuclides = Maps.newHashMap();
|
||||
for (int i = 0; i < middleData.nucl_ided_Nuclidename.size(); i++) {
|
||||
nuclides.put(middleData.nucl_ided_Nuclidename.get(i), middleData.nucl_ided_Concentration.get(i));
|
||||
}
|
||||
info.setNuclides(nuclides);
|
||||
info.setAnalyst(middleData.analyses_analyst);
|
||||
return info;
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取计算MDC参数文件方法
|
||||
*/
|
||||
|
@ -289,34 +324,17 @@ public class Sample_G_Analysis {
|
|||
/**
|
||||
* 分析成功数据发送到Redis
|
||||
*/
|
||||
private void pushToRedis(GStoreMiddleProcessData middleData){
|
||||
try {
|
||||
Info info = new Info();
|
||||
info.setStationId(this.sampleData.getStationId().toString());
|
||||
info.setSampleId(middleData.sample_id);
|
||||
info.setSampleName(middleData.analyses_save_filePath.substring(middleData.analyses_save_filePath.lastIndexOf(StringPool.SLASH)+1));
|
||||
final Instant instant = DateUtils.parseDate(middleData.sample_collection_start).toInstant();
|
||||
final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
info.setCollectionDate(collectTime);
|
||||
info.setDatasource(DSType.ARMDARR.getType());
|
||||
info.setFullOrPrel(this.sampleData.getSpectralQualifie());
|
||||
info.setBetaOrGamma(SpectrumType.GAMMA.getType());
|
||||
Map<String,String> nuclides = Maps.newHashMap();
|
||||
for (int i=0; i<middleData.nucl_ided_Nuclidename.size(); i++) {
|
||||
nuclides.put(middleData.nucl_ided_Nuclidename.get(i), middleData.nucl_ided_Concentration.get(i));
|
||||
}
|
||||
info.setNuclides(nuclides);
|
||||
info.setAnalyst(middleData.analyses_analyst);
|
||||
private void pushToRedis(Info info) {
|
||||
serviceQuotes.getRedisStreamUtil().pushAnalysis(info);
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
serviceQuotes.getRedisStreamUtil().addMessage(autoKey, info);
|
||||
|
||||
}
|
||||
|
||||
private void storageDataToDatabase(PHDFile phdFile, GStoreMiddleProcessData middleData, Map<String, QcCheckItem> qcItems) {
|
||||
//如果数据已经存储,不在重复存储
|
||||
final Integer idAnalysis = serviceQuotes.getAnalysesService().getIdAnalysis(this.sampleData.getSampleId());
|
||||
if (Objects.nonNull(idAnalysis)) {
|
||||
middleData.setIdAnalysis(String.valueOf(idAnalysis));
|
||||
// log.warn("{} file analysis data has been stored",new File(this.sampleTempFilePath).getName());
|
||||
return;
|
||||
}
|
||||
|
@ -328,6 +346,7 @@ public class Sample_G_Analysis {
|
|||
saveAnalysis(middleData, sampleId);
|
||||
// 获取分析结果ID ==> SELECT IDANALYSIS
|
||||
Integer IdAnalysis = getIdAnalysis(sampleId);
|
||||
middleData.setIdAnalysis(String.valueOf(idAnalysis));
|
||||
// 修改保存结果状态 ==> UPDATE ORIGINAL.GARDS_SAMPLE_DATA
|
||||
// serviceQuotes.getSampleDataService().updateStatus(null,null);
|
||||
/* GARDS_CALIBRATION_PAIRS 数据表保存 */
|
||||
|
@ -359,6 +378,7 @@ public class Sample_G_Analysis {
|
|||
|
||||
/**
|
||||
* 生成日志文件
|
||||
*
|
||||
* @param logFilePath
|
||||
* @param middleData
|
||||
*/
|
||||
|
@ -523,10 +543,8 @@ public class Sample_G_Analysis {
|
|||
infoMap = new LinkedHashMap<>();
|
||||
int idPeakSize = middleData.peaks_idPeak.size();
|
||||
double peaksUsed = 0;
|
||||
for(int m=0;m<middleData.peaks_Nuclide_name.size();m++)
|
||||
{
|
||||
if(!middleData.peaks_Nuclide_name.get(m).isEmpty())
|
||||
{
|
||||
for (int m = 0; m < middleData.peaks_Nuclide_name.size(); m++) {
|
||||
if (!middleData.peaks_Nuclide_name.get(m).isEmpty()) {
|
||||
peaksUsed++;
|
||||
}
|
||||
}
|
||||
|
@ -568,12 +586,10 @@ public class Sample_G_Analysis {
|
|||
// Nuclide Identified.....
|
||||
writes.add(MyLogFormatUtil.getHeaderFormat(MyLogFormatUtil.GGetPeakSearchResult));
|
||||
StringBuilder qsNuclidesName = new StringBuilder();
|
||||
for(int m = 0; m < middleData.nucl_ided_Nuclidename.size() -1; m++)
|
||||
{
|
||||
for (int m = 0; m < middleData.nucl_ided_Nuclidename.size() - 1; m++) {
|
||||
qsNuclidesName.append(middleData.nucl_ided_Nuclidename.get(m)).append(",");
|
||||
}
|
||||
if(middleData.nucl_ided_Nuclidename.size() > 1)
|
||||
{
|
||||
if (middleData.nucl_ided_Nuclidename.size() > 1) {
|
||||
qsNuclidesName.append(middleData.nucl_ided_Nuclidename.get(middleData.nucl_ided_Nuclidename.size() - 1));
|
||||
}
|
||||
infoMap = new LinkedHashMap<>();
|
||||
|
@ -716,10 +732,13 @@ public class Sample_G_Analysis {
|
|||
}
|
||||
// GARDS_CALIBRATION_PAIRS 汇总保存
|
||||
List<GardsCalibrationPairs> allPairs = new ArrayList<>();
|
||||
allPairs.addAll(pairsE);allPairs.addAll(pairsEF);
|
||||
allPairs.addAll(pairsR);allPairs.addAll(pairsT);
|
||||
allPairs.addAll(pairsE);
|
||||
allPairs.addAll(pairsEF);
|
||||
allPairs.addAll(pairsR);
|
||||
allPairs.addAll(pairsT);
|
||||
serviceQuotes.getGardsCalibrationPairsService().saveBatch(allPairs);
|
||||
}
|
||||
|
||||
public void saveCalibration(GStoreMiddleProcessData middleData,
|
||||
Integer sampleId, Integer IdAnalysis) {
|
||||
String calibrationSampleType = middleData.getCalibration_sample_type();
|
||||
|
@ -1098,6 +1117,7 @@ public class Sample_G_Analysis {
|
|||
gardsAnalyses.setScacPath(middleData.getAnalyses_scac_filePath());
|
||||
gardsAnalyses.setLogPath(middleData.getAnalyses_LogPath());
|
||||
gardsAnalyses.setReportPath(middleData.getAnalyses_ReportPath());
|
||||
gardsAnalyses.setCategory((int)middleData.analyses_category);
|
||||
return gardsAnalyses;
|
||||
}
|
||||
|
||||
|
|
|
@ -542,7 +542,11 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
if (!ReadQCLimitByStationType(qcItems, vMdcInfoMap, Be7Value, stationType, stationCode)) {
|
||||
String WARNING = "Read QC Flags from SystemManager.xml Failed!";
|
||||
}
|
||||
|
||||
if (qcItems.isEmpty()) {
|
||||
if (!ReadQCLimit(qcItems, vMdcInfoMap, Be7Value, phd.getHeader().getSystem_type().toUpperCase())) {
|
||||
String WARNING = "Read QC Flags from SystemManager.xml Failed!";
|
||||
}
|
||||
}
|
||||
//判断map是否为空
|
||||
if (CollectionUtils.isNotEmpty(vMdcInfoMap)) {
|
||||
//根据键值按顺序向数组中插入数据
|
||||
|
@ -768,7 +772,7 @@ public class GammaFileUtil extends AbstractLogOrReport {
|
|||
|
||||
public boolean ReadQCLimit(Map<String, QcCheckItem> qcItems, Map<String, Double> vMdcInfoMap, List<Double> Be7Value, String systemType) {
|
||||
try {
|
||||
String filePath = parameterProperties.getFilePath() + File.separator + "SystemManager.xml";
|
||||
String filePath = parameterProperties.getFilePath() + File.separator + "parameter.xml";
|
||||
//创建一个文档解析器工厂
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
//创建文档解析器
|
||||
|
|
|
@ -519,6 +519,7 @@
|
|||
NUMBEROFPEAKS numberOfPeaks,
|
||||
BASELINE_PATH baselinePath,
|
||||
LC_PATH lcPath,
|
||||
CATEGORY category,
|
||||
SCAC_PATH scacPath
|
||||
FROM
|
||||
${dbName}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.jeecg.common.api.QueryRequest;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.cache.LocalCache;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.properties.ParameterProperties;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
|
@ -39,8 +40,10 @@ import org.jeecg.modules.base.dto.NuclideActMdaDto;
|
|||
import org.jeecg.modules.base.dto.PeakInfoDto;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsThresholdResult;
|
||||
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
|
||||
import org.jeecg.modules.base.enums.*;
|
||||
import org.jeecg.modules.base.service.ISampleGradingService;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.entity.*;
|
||||
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
|
||||
|
@ -86,7 +89,7 @@ import static org.jeecg.modules.base.enums.ExportTemplate.*;
|
|||
@Service(value = "gammaService")
|
||||
@DS("ora")
|
||||
public class GammaServiceImpl extends AbstractLogOrReport implements IGammaService {
|
||||
|
||||
private final String manKey = RedisConstant.CATEGORY;
|
||||
@Autowired
|
||||
private LocalCache localCache;
|
||||
@Autowired
|
||||
|
@ -156,6 +159,13 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
@Autowired
|
||||
private IDataService dataService;
|
||||
|
||||
/// 样品等级服务
|
||||
@Autowired
|
||||
private ISampleGradingService sampleGradingService;
|
||||
// 获取阈值信息
|
||||
@Autowired
|
||||
private IRnManGardsThresholdService gardsThresholdService;
|
||||
|
||||
@Override
|
||||
public void initValue(Integer sampleId, String dbName, String analyst, String samfileName, HttpServletRequest request) {
|
||||
if (Objects.nonNull(sampleId) && StringUtils.isNotBlank(dbName)) {
|
||||
|
@ -332,6 +342,9 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
phd.setBaseline_path(spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getBaselinePath());
|
||||
phd.setLc_path(spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getLcPath());
|
||||
phd.setScac_path(spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + analysis.getScacPath());
|
||||
if (analysis.getCategory()!=null){
|
||||
phd.setCategory(analysis.getCategory().toString());
|
||||
}
|
||||
peakNum = analysis.getNumberOfPeaks();
|
||||
phd.setTotalCmt(analysis.getComments());
|
||||
phd.getBaseCtrls().setRg_low(analysis.getSearchStartChannel());
|
||||
|
@ -4765,6 +4778,22 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
if (comments.length() > 1024) {
|
||||
comments = comments.substring(0, 1024);
|
||||
}
|
||||
middleData.setSample_stationID(String.valueOf(stationId));
|
||||
middleData.setSample_id(String.valueOf(phd.getId_sample()));
|
||||
Info info = getSampleInfo(middleData, phd);
|
||||
|
||||
//TODO 获取样品级别
|
||||
try {
|
||||
//获取阈值结果
|
||||
List<GardsThresholdResult> thresholds = gardsThresholdService.findThresholdResults(stationId.toString());
|
||||
//样品分级
|
||||
Integer category = sampleGradingService.processTypeP(info, thresholds);
|
||||
middleData.setAnalyses_category(category);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 判断idAnalysis是否为空
|
||||
if (StringUtils.isBlank(idAnalysis)) {
|
||||
// 向 RNMAN.GARDS_ANALYSES 表插入数据
|
||||
|
@ -4881,9 +4910,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
List<String> detailedInfo = gammaFileUtil.DetailedInfo(phd.getId_sample(), phd);
|
||||
map.put("DetailedInformation", detailedInfo);
|
||||
//发送数据到redis
|
||||
middleData.setSample_stationID(String.valueOf(stationId));
|
||||
middleData.setSample_id(String.valueOf(phd.getId_sample()));
|
||||
pushToRedis(middleData, phd);
|
||||
pushToRedis(info);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
|
@ -4892,11 +4919,19 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
/**
|
||||
* 分析成功数据发送到Redis
|
||||
*/
|
||||
private void pushToRedis(GStoreMiddleProcessData middleData, PHDFile phd){
|
||||
private void pushToRedis(Info info) {
|
||||
|
||||
redisStreamUtil.pushAnalysis(info);
|
||||
redisStreamUtil.addMessage(manKey, info);
|
||||
}
|
||||
|
||||
private Info getSampleInfo(GStoreMiddleProcessData middleData, PHDFile phd) {
|
||||
try {
|
||||
Info info = new Info();
|
||||
info.setStationId(middleData.sample_stationID);
|
||||
info.setSampleId(middleData.sample_id);
|
||||
info.setIdAnalysis(middleData.IdAnalysis);
|
||||
info.setSampleType(middleData.sample_Type);
|
||||
info.setSampleName(middleData.analyses_save_filePath.substring(middleData.analyses_save_filePath.lastIndexOf(StringPool.SLASH) + 1));
|
||||
final Instant instant = DateUtils.parseDate(middleData.sample_collection_start).toInstant();
|
||||
final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
|
@ -4910,7 +4945,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
|
|||
}
|
||||
info.setNuclides(nuclides);
|
||||
info.setAnalyst(middleData.analyses_analyst);
|
||||
redisStreamUtil.pushAnalysis(info);
|
||||
return info;
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ public class GardsAnalysesSpectrumServiceImpl extends ServiceImpl<GardsAnalysesM
|
|||
analyses.setAnalysisBegin(DateUtils.parseDate(phd.getAnaly_start_time()));
|
||||
analyses.setAnalysisEnd(new Date());
|
||||
analyses.setType(middleData.analyses_type);
|
||||
analyses.setCategory((int) middleData.analyses_category);
|
||||
analyses.setSoftware("");
|
||||
analyses.setSwVersion("1.0.1");
|
||||
analyses.setAnalyst(userName);
|
||||
|
@ -57,6 +58,7 @@ public class GardsAnalysesSpectrumServiceImpl extends ServiceImpl<GardsAnalysesM
|
|||
analyses.setAnalysisBeginStr(phd.getAnaly_start_time());
|
||||
analyses.setAnalysisEndStr(DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss"));
|
||||
analyses.setSoftware("");
|
||||
analyses.setCategory((int) middleData.analyses_category);
|
||||
analyses.setSwVersion("1.0.1");
|
||||
analyses.setComments(comments);
|
||||
analyses.setSearchStartChannel((int) middleData.analyses_searchStartChannel);
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.jeecg.common.api.QueryRequest;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.cache.BetaCache;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.constant.RedisConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.properties.ParameterProperties;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
|
@ -37,6 +38,7 @@ import org.jeecg.modules.base.entity.original.GardsSampleAux;
|
|||
import org.jeecg.modules.base.entity.original.GardsSampleData;
|
||||
import org.jeecg.modules.base.entity.rnman.*;
|
||||
import org.jeecg.modules.base.enums.*;
|
||||
import org.jeecg.modules.base.service.ISampleGradingService;
|
||||
import org.jeecg.modules.entity.*;
|
||||
import org.jeecg.modules.entity.vo.*;
|
||||
import org.jeecg.modules.entity.vo.QCFlagParmData.Rule;
|
||||
|
@ -75,7 +77,7 @@ import static org.jeecg.modules.base.enums.ExportTemplate.*;
|
|||
@Service("spectrumAnalysisService")
|
||||
@DS("ora")
|
||||
public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements ISpectrumAnalysisService {
|
||||
|
||||
private final String manKey = RedisConstant.CATEGORY;
|
||||
@Autowired
|
||||
private SpectrumAnalysisMapper spectrumAnalysisMapper;
|
||||
@Autowired
|
||||
|
@ -135,6 +137,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
@Autowired
|
||||
private IGardsROIResultsSpectrumService gardsROIResultsSpectrumService;
|
||||
|
||||
/// 样品等级服务
|
||||
@Autowired
|
||||
private ISampleGradingService sampleGradingService;
|
||||
// 获取阈值信息
|
||||
@Autowired
|
||||
private IRnManGardsThresholdService gardsThresholdService;
|
||||
|
||||
@Override
|
||||
public void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
|
||||
|
@ -714,7 +722,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
|
||||
// 查询Gas谱
|
||||
GardsSampleData gasSampleData = sampleDataSpectrumService.getSampleByMId(aux.getGasBkgdMeasurementId(),
|
||||
DataTypeAbbr.DETBKPHD.getType(), sampleData.getSampleType());
|
||||
DataTypeAbbr.GASBKPHD.getType(), sampleData.getSampleType());
|
||||
|
||||
if (StringUtils.isEmpty(sampleFilePath)
|
||||
&& (Objects.isNull(gasSampleData) || StringUtils.isEmpty(gasSampleData.getInputFileName()))
|
||||
|
@ -4498,6 +4506,16 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
sampleId = spectrumAnalysisMapper.getSampleId(sampleFilePathName);
|
||||
gasId = spectrumAnalysisMapper.getSampleId(gasFilePathName);
|
||||
detId = spectrumAnalysisMapper.getSampleId(detFilePathName);
|
||||
betaDataFile.setSampleId(String.valueOf(sampleId));
|
||||
|
||||
Info info = getSampleInfo(betaDataFile, userName);
|
||||
// 获取级别信息
|
||||
//获取阈值结果
|
||||
List<GardsThresholdResult> thresholds = gardsThresholdService.findThresholdResults(stationId.toString());
|
||||
|
||||
Integer category = sampleGradingService.processTypeB(info, thresholds);
|
||||
|
||||
|
||||
//如果分析过就修改原记录--GARDS_ANALYSES
|
||||
GardsAnalysesSpectrum gardsAnalyses = new GardsAnalysesSpectrum();
|
||||
gardsAnalyses.setSampleId(sampleId);
|
||||
|
@ -4506,7 +4524,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
gardsAnalyses.setType(AnalysesType.REVIEWED.value);
|
||||
gardsAnalyses.setSoftware("BetaGammaAnalyser");
|
||||
gardsAnalyses.setSwVersion("1.0.1");
|
||||
gardsAnalyses.setCategory(1);
|
||||
gardsAnalyses.setCategory(category);
|
||||
gardsAnalyses.setComments(anlyseResultIn.getComment());
|
||||
gardsAnalyses.setUsedgasphd(gasFilePathName);
|
||||
gardsAnalyses.setUseddetphd(detFilePathName);
|
||||
|
@ -4520,7 +4538,6 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
} else {//如果没有分析过就新增--GARDS_ANALYSES
|
||||
spectrumAnalysisMapper.insertGardsAnalyses(gardsAnalyses);
|
||||
}
|
||||
betaDataFile.setSampleId(String.valueOf(sampleId));
|
||||
//查询analysisId根据sampleId 分析员名称--GARDS_ANALYSES
|
||||
GardsAnalysesSpectrum analysis = spectrumAnalysisMapper.getAnalysis("RNMAN.GARDS_ANALYSES", sampleId, userName);
|
||||
Integer idAnalysis = analysis.getIdAnalysis();
|
||||
|
@ -4672,7 +4689,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
map.put("qc", qcData);
|
||||
}
|
||||
//发送数据到redis
|
||||
pushToRedis(betaDataFile, userName);
|
||||
pushToRedis(info);
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
|
@ -4866,11 +4883,17 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
/**
|
||||
* 分析成功数据发送到Redis
|
||||
*/
|
||||
private void pushToRedis(BetaDataFile betaDataFile, String userName) {
|
||||
private void pushToRedis(Info info) {
|
||||
redisStreamUtil.pushAnalysis(info);
|
||||
redisStreamUtil.addMessage(manKey, info);
|
||||
}
|
||||
|
||||
private Info getSampleInfo(BetaDataFile betaDataFile, String userName) {
|
||||
try {
|
||||
Info info = new Info();
|
||||
info.setStationId(betaDataFile.getStationId());
|
||||
info.setSampleId(betaDataFile.getSampleId());
|
||||
info.setSampleType(betaDataFile.getSampleStruct().system_type);
|
||||
info.setSampleName(betaDataFile.getSampleFileName());
|
||||
final Instant instant = DateUtils.parseDate(betaDataFile.getSampleStruct().collection_start_date + StringPool.SPACE + betaDataFile.getSampleStruct().collection_start_time).toInstant();
|
||||
final LocalDateTime collectTime = instant.atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
|
@ -4893,7 +4916,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements
|
|||
}
|
||||
info.setNuclides(nuclides);
|
||||
info.setAnalyst(userName);
|
||||
redisStreamUtil.pushAnalysis(info);
|
||||
return info;
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user