根据sampleFileName获取文件名称接口修改
XeData返回内容增加flag字段数据
This commit is contained in:
parent
5f7cc6be38
commit
34ae278463
|
@ -253,7 +253,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
result.error500("ftp文件查询失败");
|
||||
return result;
|
||||
}
|
||||
String sampleFileName = fileName;
|
||||
String sampleFileName = matchFileName;
|
||||
String sampleSystemType = fileData.get("sampleSystemType");
|
||||
if (sampleSystemType.equals(SystemType.BETA.getType())) {
|
||||
//加载并获取当前路径下所有的文件名称并进行名称格式化 仅需要格式化和sample文件同一个台站 名称格式化为最终名称
|
||||
|
@ -2539,10 +2539,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
}
|
||||
map.put("XeData", xeDataList);
|
||||
|
@ -2610,10 +2613,13 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
Double mdc = xeData.getMdc();
|
||||
if (conc < 0){
|
||||
xeData.setColor("red");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (0<conc && conc < mdc) {
|
||||
xeData.setColor("#ffcc30");
|
||||
xeData.setNidFlag(0);
|
||||
} else if (conc > mdc) {
|
||||
xeData.setColor("green");
|
||||
xeData.setNidFlag(1);
|
||||
}
|
||||
}
|
||||
map.put("XeData", xeDataList);
|
||||
|
@ -2630,6 +2636,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
@Override
|
||||
public Result saveToDB(BgDataAnlyseResultIn anlyseResultIn) {
|
||||
Result result = new Result();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String beginDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
String endDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
//判断当前分析员是否有过排班任务
|
||||
|
@ -2643,29 +2650,35 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
getChannelAndEnergy(anlyseResultIn);
|
||||
//获取ROI Limit数据
|
||||
// getROILimit(anlyseResultIn);
|
||||
//计算得到各文件的边界值
|
||||
BgBoundary sampleBoundary = phdFileUtil.CalBoundary(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
BgBoundary gasBoundary = phdFileUtil.CalBoundary(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||
BgBoundary detBoundary = phdFileUtil.CalBoundary(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||
//处理文件名称
|
||||
String sampleFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
String gasFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||
String detFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||
//判断文件是否存储过 如果没有则解析文件并进行存储
|
||||
if ( !OriginalDataStore(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName(), gasFilePathName, anlyseResultIn.getUserName()) ){
|
||||
result.error500("file save failed");
|
||||
result.error500("gasFile save failed");
|
||||
return result;
|
||||
}
|
||||
if ( !OriginalDataStore(anlyseResultIn.getDetFilePath(), anlyseResultIn.getGasFileName(), detFilePathName, anlyseResultIn.getUserName()) ){
|
||||
result.error500("file save failed");
|
||||
result.error500("detFile save failed");
|
||||
return result;
|
||||
}
|
||||
if ( !OriginalDataStore(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName(), sampleFilePathName, anlyseResultIn.getUserName()) ){
|
||||
result.error500("file save failed");
|
||||
result.error500("sampleFile save failed");
|
||||
return result;
|
||||
}
|
||||
//判断当前分析员是否有过历史分析当前文件
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(sampleFilePathName, anlyseResultIn.getUserName());
|
||||
//获取sample,gas,det对应的临时文件
|
||||
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||
File detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
|
||||
if (Objects.isNull(sampleTmp) || Objects.isNull(gasTmp) || Objects.isNull(detTmp)) {
|
||||
result.error500("ftp文件获取失败!");
|
||||
return result;
|
||||
}
|
||||
//解析文件内容获取对应数据
|
||||
BgDataAnlyseResultIn resultIn = phdFileUtil.analyzeSpectrum(sampleTmp, gasTmp, detTmp, map);
|
||||
//根据文件名称查询对应的sampleId--- sampleFile gasFile detFile
|
||||
Integer sampleId = spectrumAnalysisMapper.getSampleId(sampleFilePathName);
|
||||
Integer gasId = spectrumAnalysisMapper.getSampleId(gasFilePathName);
|
||||
|
@ -2685,79 +2698,88 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
gardsAnalyses.setUsedgasphdId(gasId);
|
||||
gardsAnalyses.setUseddetphdId(detId);
|
||||
gardsAnalyses.setAnalyst(anlyseResultIn.getUserName());
|
||||
map.put("gardsAnalyses", gardsAnalyses);
|
||||
if (Objects.nonNull(isExist)){
|
||||
spectrumAnalysisMapper.updateGardsAnalyses(gardsAnalyses);
|
||||
//spectrumAnalysisMapper.updateGardsAnalyses(gardsAnalyses);
|
||||
}else {//如果没有分析过就新增--GARDS_ANALYSES
|
||||
spectrumAnalysisMapper.insertGardsAnalyses(gardsAnalyses);
|
||||
//spectrumAnalysisMapper.insertGardsAnalyses(gardsAnalyses);
|
||||
}
|
||||
//查询analysisId根据sampleId 分析员名称--GARDS_ANALYSES
|
||||
GardsAnalysesSpectrum analysis = spectrumAnalysisMapper.getAnalysis("RNMAN.GARDS_ANALYSES", sampleId);
|
||||
Integer idAnalysis = analysis.getIdAnalysis();
|
||||
//获取sample,gas,det三个文件分别对应的beta,gamma数据集合
|
||||
List<GardsCalibrationPairsSpectrum> calibrationPairsList = getCalibrationPairs(anlyseResultIn, sampleId, gasId, detId, idAnalysis);
|
||||
map.put("calibrationPairsList", calibrationPairsList);
|
||||
//如果分析过--删除GARDS_CALIBRATION_PAIRS表数据 新增GARDS_CALIBRATION_PAIRS表数据
|
||||
if (Objects.nonNull(isExist)){
|
||||
//根据idAnalysis删除GARDS_CALIBRATION_PAIRS表数据
|
||||
spectrumAnalysisMapper.deleteCalibrationPairs(idAnalysis);
|
||||
//spectrumAnalysisMapper.deleteCalibrationPairs(idAnalysis);
|
||||
//新增GARDS_CALIBRATION_PAIRS表数据
|
||||
spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairsList);
|
||||
//spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairsList);
|
||||
}else {//如果没有分析过--新增GARDS_CALIBRATION_PAIRS表数据
|
||||
//新增GARDS_CALIBRATION_PAIRS表数据
|
||||
spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairsList);
|
||||
//spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairsList);
|
||||
}
|
||||
//gards_calibration 数据表
|
||||
List<GardsCalibrationSpectrum> calibrationList = getCalibration(anlyseResultIn, sampleId, gasId, detId, idAnalysis);
|
||||
map.put("calibrationList", calibrationList);
|
||||
//判断是否分析过
|
||||
if (Objects.nonNull(isExist)) {
|
||||
//删除Gards_Calibration表数据
|
||||
spectrumAnalysisMapper.deleteCalibration(idAnalysis);
|
||||
//spectrumAnalysisMapper.deleteCalibration(idAnalysis);
|
||||
//新增数据
|
||||
spectrumAnalysisMapper.insertCalibration(calibrationList);
|
||||
//spectrumAnalysisMapper.insertCalibration(calibrationList);
|
||||
} else {
|
||||
//新增数据
|
||||
spectrumAnalysisMapper.insertCalibration(calibrationList);
|
||||
//spectrumAnalysisMapper.insertCalibration(calibrationList);
|
||||
}
|
||||
//gards_roi_channels数据表
|
||||
List<GardsROIChannelsSpectrum> roiChannelsList = new LinkedList<>();
|
||||
getROIChannel(sampleId, idAnalysis, sampleBoundary, roiChannelsList);
|
||||
getROIChannel(gasId, idAnalysis, gasBoundary, roiChannelsList);
|
||||
getROIChannel(detId, idAnalysis, detBoundary, roiChannelsList);
|
||||
List<GardsROIChannelsSpectrum> roiChannelsSpectrumList = (List<GardsROIChannelsSpectrum>) map.get("roiChannelsSpectrumList");
|
||||
getROIChannel(sampleId, idAnalysis, roiChannelsSpectrumList, roiChannelsList);
|
||||
getROIChannel(gasId, idAnalysis, roiChannelsSpectrumList, roiChannelsList);
|
||||
getROIChannel(detId, idAnalysis, roiChannelsSpectrumList, roiChannelsList);
|
||||
map.put("roiChannelsList", roiChannelsList);
|
||||
//如果分析过数据
|
||||
if (Objects.nonNull(isExist)){
|
||||
//删除gards_roi_channels数据表数据
|
||||
spectrumAnalysisMapper.deleteROIChannels(idAnalysis);
|
||||
//spectrumAnalysisMapper.deleteROIChannels(idAnalysis);
|
||||
//新增gards_roi_channels数据表数据
|
||||
spectrumAnalysisMapper.insertROIChannels(roiChannelsList);
|
||||
//spectrumAnalysisMapper.insertROIChannels(roiChannelsList);
|
||||
}else {//没有分析过
|
||||
//新增gards_roi_channels数据表数据
|
||||
spectrumAnalysisMapper.insertROIChannels(roiChannelsList);
|
||||
//spectrumAnalysisMapper.insertROIChannels(roiChannelsList);
|
||||
}
|
||||
//gards_Xe_results数据表
|
||||
List<GardsXeResultsSpectrum> xeResults = getXeResults(anlyseResultIn, sampleId, idAnalysis);
|
||||
map.put("xeResults", xeResults);
|
||||
if(Objects.nonNull(isExist)) {
|
||||
//删除gards_Xe_results数据表数据
|
||||
spectrumAnalysisMapper.deleteXeResult(idAnalysis);
|
||||
//spectrumAnalysisMapper.deleteXeResult(idAnalysis);
|
||||
//新增gards_Xe_results数据表数据
|
||||
spectrumAnalysisMapper.insertXeResult(xeResults);
|
||||
//spectrumAnalysisMapper.insertXeResult(xeResults);
|
||||
} else {
|
||||
//新增gards_Xe_results数据表数据
|
||||
spectrumAnalysisMapper.insertXeResult(xeResults);
|
||||
//spectrumAnalysisMapper.insertXeResult(xeResults);
|
||||
}
|
||||
//gards_roi_results数据表
|
||||
List<GardsROIResultsSpectrum> roiResultsSpectrumList = getROIResult(anlyseResultIn, sampleId, idAnalysis, isExist);
|
||||
map.put("roiResultsSpectrumList", roiResultsSpectrumList);
|
||||
if(Objects.nonNull(isExist)) {
|
||||
//删除gards_roi_results数据表数据
|
||||
spectrumAnalysisMapper.deleteROIResults(idAnalysis);
|
||||
//spectrumAnalysisMapper.deleteROIResults(idAnalysis);
|
||||
//新增gards_roi_results数据表数据
|
||||
|
||||
//spectrumAnalysisMapper.insertROIResults(roiResultsSpectrumList);
|
||||
} else {
|
||||
//新增gards_roi_results数据表数据
|
||||
|
||||
//spectrumAnalysisMapper.insertROIResults(roiResultsSpectrumList);
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn){
|
||||
public void getChannelAndEnergy(BgDataAnlyseResultIn anlyseResultIn) {
|
||||
//获取ftp文件路径下临时文件
|
||||
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
|
||||
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
|
||||
|
@ -2965,7 +2987,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
uncertaintyList.add(String.valueOf(uncertainty.get(pos)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<GardsCalibrationSpectrum> getCalibration(BgDataAnlyseResultIn anlyseResultIn, Integer sampleId, Integer gasId, Integer detId, Integer idAnalysis) {
|
||||
|
@ -3059,16 +3080,16 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
return calibrationSpectrumList;
|
||||
}
|
||||
|
||||
public void getROIChannel(Integer sampleId, Integer idAnalysis, BgBoundary bgBoundary, List<GardsROIChannelsSpectrum> roiChannelsList) {
|
||||
for (int i=0; i<bgBoundary.ROI_B_Boundary_start.size(); i++){
|
||||
public void getROIChannel(Integer sampleId, Integer idAnalysis, List<GardsROIChannelsSpectrum> roiChannelsSpectrumList, List<GardsROIChannelsSpectrum> roiChannelsList) {
|
||||
for (int i=0; i<roiChannelsSpectrumList.size(); i++){
|
||||
GardsROIChannelsSpectrum roiChannels = new GardsROIChannelsSpectrum();
|
||||
roiChannels.setSampleId(sampleId);
|
||||
roiChannels.setIdAnalysis(idAnalysis);
|
||||
roiChannels.setRoi(i);
|
||||
roiChannels.setBChanStart(bgBoundary.ROI_B_Boundary_start.get(i));
|
||||
roiChannels.setBChanStop(bgBoundary.ROI_B_Boundary_stop.get(i));
|
||||
roiChannels.setGChanStart(bgBoundary.ROI_G_Boundary_start.get(i));
|
||||
roiChannels.setGChanStop(bgBoundary.ROI_G_Boundary_stop.get(i));
|
||||
roiChannels.setBChanStart(roiChannelsSpectrumList.get(i).getBChanStart());
|
||||
roiChannels.setBChanStop(roiChannelsSpectrumList.get(i).getBChanStop());
|
||||
roiChannels.setGChanStart(roiChannelsSpectrumList.get(i).getGChanStart());
|
||||
roiChannels.setGChanStop(roiChannelsSpectrumList.get(i).getGChanStop());
|
||||
roiChannelsList.add(roiChannels);
|
||||
}
|
||||
}
|
||||
|
@ -3123,6 +3144,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
}
|
||||
|
||||
public boolean OriginalDataStore(String filePath, String fileName, String filePathName, String userName) {
|
||||
//根据新的文件路径名称查询数据是否存在
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(filePathName, userName);
|
||||
//如果数据已经存入过数据库 则 修改状态后返回
|
||||
if (Objects.nonNull(isExist)){
|
||||
//如果文件已经存入过数据库则修改状态
|
||||
spectrumAnalysisMapper.updateAnalysesStatus(filePathName);
|
||||
return true;
|
||||
}
|
||||
//连接ftp
|
||||
FTPClient ftpClient = ftpUtil.LoginFTP();
|
||||
InputStream inputStream = null;
|
||||
|
@ -3170,14 +3199,6 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
|
||||
//获取文件中块名信息
|
||||
List<String> readLines = getFileBlockList(file);
|
||||
//根据新的文件路径名称查询数据是否存在
|
||||
Integer isExist = spectrumAnalysisMapper.SampleIsExist(filePathName, userName);
|
||||
//如果数据已经存入过数据库 则 修改状态后返回
|
||||
if (Objects.nonNull(isExist)){
|
||||
//如果文件已经存入过数据库则修改状态
|
||||
spectrumAnalysisMapper.updateAnalysesStatus(filePathName);
|
||||
return true;
|
||||
}
|
||||
//查询台站id
|
||||
Integer stationId = spectrumAnalysisMapper.getStationId(sourceData.site_code);
|
||||
Integer detectorId = spectrumAnalysisMapper.getDetectorId(sourceData.detector_code);
|
||||
|
@ -3244,35 +3265,28 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
|
||||
public List<GardsROIResultsSpectrum> getROIResult(BgDataAnlyseResultIn anlyseResultIn, Integer sampleId, Integer idAnalysis, Integer isExist) {
|
||||
List<GardsROIResultsSpectrum> roiResultsSpectrumList = new LinkedList<>();
|
||||
//第一种 直接从数据库获取的 并没有进行过改变
|
||||
if (Objects.nonNull(isExist) && !anlyseResultIn.isBProcessed()) {
|
||||
for (int i=0; i<anlyseResultIn.getS_roi_cts().size(); i++) {
|
||||
GardsROIResultsSpectrum roiResults = new GardsROIResultsSpectrum();
|
||||
roiResults.setSampleId(sampleId);
|
||||
roiResults.setIdAnalysis(idAnalysis);
|
||||
roiResults.setRoi(i);
|
||||
roiResults.setLc(anlyseResultIn.getLC().get(i));
|
||||
roiResults.setSGross(anlyseResultIn.getS_roi_cts().get(i));
|
||||
roiResults.setGGross(anlyseResultIn.getG_roi_cts().get(i));
|
||||
roiResults.setBGross(anlyseResultIn.getD_roi_cts().get(i));
|
||||
roiResults.setSNet(anlyseResultIn.getS_deduct_d_cts().get(i));
|
||||
roiResults.setGNet(anlyseResultIn.getG_deduct_d_cts().get(i));
|
||||
roiResults.setNet(anlyseResultIn.getROI_net_coutns().get(i));
|
||||
roiResults.setNetErr(anlyseResultIn.getROI_net_err().get(i));
|
||||
roiResults.setConc(anlyseResultIn.getROI_con_uncer().get(i));
|
||||
roiResults.setConcErr(anlyseResultIn.getROI_con_uncer().get(i));
|
||||
roiResults.setMdc(anlyseResultIn.getMDC().get(i));
|
||||
if(anlyseResultIn.getROI_con_uncer().get(i)>anlyseResultIn.getMDC().get(i)) {
|
||||
roiResults.setNidFlag(1);
|
||||
} else {
|
||||
roiResults.setNidFlag(0);
|
||||
}
|
||||
roiResultsSpectrumList.add(roiResults);
|
||||
for (int i=0; i<anlyseResultIn.getS_roi_cts().size(); i++) {
|
||||
GardsROIResultsSpectrum roiResults = new GardsROIResultsSpectrum();
|
||||
roiResults.setSampleId(sampleId);
|
||||
roiResults.setIdAnalysis(idAnalysis);
|
||||
roiResults.setRoi(i);
|
||||
roiResults.setLc(anlyseResultIn.getLC().get(i));
|
||||
roiResults.setSGross(anlyseResultIn.getS_roi_cts().get(i));
|
||||
roiResults.setGGross(anlyseResultIn.getG_roi_cts().get(i));
|
||||
roiResults.setBGross(anlyseResultIn.getD_roi_cts().get(i));
|
||||
roiResults.setSNet(anlyseResultIn.getS_deduct_d_cts().get(i));
|
||||
roiResults.setGNet(anlyseResultIn.getG_deduct_d_cts().get(i));
|
||||
roiResults.setNet(anlyseResultIn.getROI_net_coutns().get(i));
|
||||
roiResults.setNetErr(anlyseResultIn.getROI_net_err().get(i));
|
||||
roiResults.setConc(anlyseResultIn.getROI_con_uncer().get(i));
|
||||
roiResults.setConcErr(anlyseResultIn.getROI_con_uncer().get(i));
|
||||
roiResults.setMdc(anlyseResultIn.getMDC().get(i));
|
||||
if(anlyseResultIn.getROI_con_uncer().get(i)>anlyseResultIn.getMDC().get(i)) {
|
||||
roiResults.setNidFlag(1);
|
||||
} else {
|
||||
roiResults.setNidFlag(0);
|
||||
}
|
||||
} else if (Objects.nonNull(isExist) && anlyseResultIn.isBProcessed()) {//第二种 从数据库获取的但是进行过改变
|
||||
|
||||
} else if (Objects.isNull(isExist) && anlyseResultIn.isBProcessed()) {//第三种 文件加载的数据
|
||||
|
||||
roiResultsSpectrumList.add(roiResults);
|
||||
}
|
||||
return roiResultsSpectrumList;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user