From a2e48e5b846ab3343151ad565fdca86251a13ce4 Mon Sep 17 00:00:00 2001 From: xiaoguangbin Date: Fri, 9 Aug 2024 15:54:47 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E6=96=B0beta?= =?UTF-8?q?=E7=9A=84=E4=BF=9D=E5=AD=98=E6=8E=A5=E5=8F=A3=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E9=9D=9E=E5=B8=B8=E6=85=A2=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/common/util/PHDFileUtil.java | 39 ++++++++++++ .../jeecg/common/util/SelfStationUtil.java | 32 ++++++++++ .../service/impl/SelfStationServiceImpl.java | 59 ++++++------------- 3 files changed, 88 insertions(+), 42 deletions(-) diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java index 70493378..e2700a9a 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/PHDFileUtil.java @@ -889,6 +889,45 @@ public class PHDFileUtil extends AbstractLogOrReport { return path.toString(); } } + public String NameStandardBy(String fileName, String systemType,String dataType) { + StringBuffer path = new StringBuffer(); + try { + if(systemType.contains("B")) { + path.append("Spectrum"); + path.append(StringPool.SLASH+"Xenon"); + path.append(StringPool.SLASH+"Sauna"); + } else if(systemType.contains("G")) { + path.append("Spectrum"); + path.append(StringPool.SLASH+"Xenon"); + path.append(StringPool.SLASH+"Spalax"); + } else if (systemType.contains("C")) { + path.append("Spectrum"); + path.append(StringPool.SLASH+"Xenon"); + path.append(StringPool.SLASH+"Self"); + } + if(dataType.contains("SAMPLEPHD")) { + path.append(StringPool.SLASH+"Samplephd"); + } else if(dataType.contains("DETBKPHD")) { + path.append(StringPool.SLASH+"Detbkphd"); + } else if(dataType.contains("GASBKPHD")) { + path.append(StringPool.SLASH+"Gasbkphd"); + } else if(dataType.contains("QCPHD")) { + path.append(StringPool.SLASH+"Qcphd"); + } + int pos = fileName.indexOf('-'); + if(-1 == pos) { + + } else if(fileName.length() >= pos+7) { + path.append(StringPool.SLASH+fileName.substring(pos+1,pos+5)); + path.append(StringPool.SLASH+fileName.substring(pos+5,pos+7)); + } + path.append(StringPool.SLASH+fileName); + return path.toString(); + }catch (Exception e){ + e.printStackTrace(); + return path.toString(); + } + } public List FileNameByStandardForm(String filePath, String sampleFileName) { //用于最后的结果 diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/SelfStationUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/SelfStationUtil.java index de6a6225..9ce26827 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/SelfStationUtil.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/SelfStationUtil.java @@ -939,6 +939,38 @@ public class SelfStationUtil extends AbstractLogOrReport { return phd; } + /** + * 创建Gamma PHD文件并转换为数据存入SelfStationVueData + * @param path PHD保存地址 + * @param sampleFileName beta样品谱名称 + * @param struct beta谱数据 + * @param sampleVueData 存储数据实体 + */ + public void createGamma(String path, String sampleFileName, EnergySpectrumStruct struct, SelfStationVueData sampleVueData){ + // 根据ROI生成四个Gamma谱文件, 文件命名为Beta名称后面_ROI_x.PHD + String gammaOneName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_1.PHD"; + // 创建Gamma文件 + this.createGammaFile(path, gammaOneName, struct, sampleVueData.getROIOneCounts()); + + String gammaTwoName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_2.PHD"; + this.createGammaFile(path, gammaTwoName, struct, sampleVueData.getROITwoCounts()); + + String gammaThreeName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_3.PHD"; + this.createGammaFile(path, gammaThreeName, struct, sampleVueData.getROIThreeCounts()); + + String gammaFourName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_4.PHD"; + this.createGammaFile(path, gammaFourName, struct, sampleVueData.getROIFourCounts()); + + // Gamma文件内容转换为PHD实体 + sampleVueData.setROIOneFileName(gammaOneName); + sampleVueData.setROIOnePHDFile(this.getGammaPHD(gammaOneName, path)); + sampleVueData.setROITwoFileName(gammaTwoName); + sampleVueData.setROITwoPHDFile(this.getGammaPHD(gammaTwoName, path)); + sampleVueData.setROIThreeFileName(gammaThreeName); + sampleVueData.setROIThreePHDFile(this.getGammaPHD(gammaThreeName, path)); + sampleVueData.setROIFourFileName(gammaFourName); + sampleVueData.setROIFourPHDFile(this.getGammaPHD(gammaFourName, path)); + } /** * 根据ROI卡出来的Gamma数据生成新的GammaPHD文件 * @param pathName 文件存储路径 diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java index 0290db0f..6724adb3 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SelfStationServiceImpl.java @@ -27,6 +27,7 @@ import org.jeecg.common.properties.ParameterProperties; import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.system.util.JwtUtil; import org.jeecg.common.util.*; +import org.jeecg.modules.base.abstracts.AbstractLogOrReport; import org.jeecg.modules.base.dto.RoiDto; import org.jeecg.modules.base.entity.configuration.GardsNuclLib; import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib; @@ -61,9 +62,9 @@ import java.util.*; import java.util.stream.Collectors; -@Service +@Service("SelfStationService") @DS("ora") -public class SelfStationServiceImpl implements ISelfStationService { +public class SelfStationServiceImpl extends AbstractLogOrReport implements ISelfStationService { @Autowired private GammaFileUtil gammaFileUtil; @@ -417,29 +418,7 @@ public class SelfStationServiceImpl implements ISelfStationService { SelfStationVueData sampleVueData = selfStationData.getSampleVueData(); - // 根据ROI生成四个Gamma谱文件, 文件命名为Beta名称后面_ROI_x.PHD - String gammaOneName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_1.PHD"; - // 创建Gamma文件 - selfStationUtil.createGammaFile(path, gammaOneName, selfStationData.getSampleStruct(), sampleVueData.getROIOneCounts()); - - String gammaTwoName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_2.PHD"; - selfStationUtil.createGammaFile(path, gammaTwoName, selfStationData.getSampleStruct(), sampleVueData.getROITwoCounts()); - - String gammaThreeName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_3.PHD"; - selfStationUtil.createGammaFile(path, gammaThreeName, selfStationData.getSampleStruct(), sampleVueData.getROIThreeCounts()); - - String gammaFourName = StrUtil.subBefore(sampleFileName, ".PHD", true) + "_ROI_4.PHD"; - selfStationUtil.createGammaFile(path, gammaFourName, selfStationData.getSampleStruct(), sampleVueData.getROIFourCounts()); - - // Gamma文件内容转换为PHD实体 - sampleVueData.setROIOneFileName(gammaOneName); - sampleVueData.setROIOnePHDFile(selfStationUtil.getGammaPHD(gammaOneName, path)); - sampleVueData.setROITwoFileName(gammaTwoName); - sampleVueData.setROITwoPHDFile(selfStationUtil.getGammaPHD(gammaTwoName, path)); - sampleVueData.setROIThreeFileName(gammaThreeName); - sampleVueData.setROIThreePHDFile(selfStationUtil.getGammaPHD(gammaThreeName, path)); - sampleVueData.setROIFourFileName(gammaFourName); - sampleVueData.setROIFourPHDFile(selfStationUtil.getGammaPHD(gammaFourName, path)); + selfStationUtil.createGamma(path, sampleFileName, struct, sampleVueData); resultMap.put("sample", map); // 初始化Configure @@ -581,7 +560,6 @@ public class SelfStationServiceImpl implements ISelfStationService { BeanUtils.copyProperties(roiFourPHDFile.getSetting(), roiFourPHDFile.getUsedSetting()); } - @DS("ora") public void initConfigure(Integer idAnalysis, SelfStationData selfStationData){ GardsAnalySetting analySetting = spectrumAnalysisMapper.getAnalySetting(idAnalysis); if (Objects.nonNull(analySetting)) { @@ -677,7 +655,13 @@ public class SelfStationServiceImpl implements ISelfStationService { roiBBoundaryStart.add(roiParam.getRoiNum() - 1, roiParam.getStartChannel()); roiBBoundaryStop.add(roiParam.getRoiNum() - 1, roiParam.getEndChannel()); } + + // 根据ROI卡Gamma能谱数据 selfStationUtil.getGammaByROI("sample", roiBBoundaryStart, roiBBoundaryStop, selfStationData); + SelfStationVueData sampleData = selfStationData.getSampleVueData(); + String path = StrUtil.subBefore(selfStationData.getSampleFilePathName(), StringPool.SLASH, true); + // 生成gamma数据 + selfStationUtil.createGamma(path, selfStationData.getSampleFileName(), struct, sampleData); } @Override @@ -4570,7 +4554,6 @@ public class SelfStationServiceImpl implements ISelfStationService { @Override - @DS("ora") public Result NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request) { Result result = new Result(); Map map = new HashMap<>(); @@ -4745,7 +4728,6 @@ public class SelfStationServiceImpl implements ISelfStationService { } @Override - @DS("ora") public Result configUserLibrary(Integer sampleId, String fileName, HttpServletRequest request) { Result result = new Result(); Map> map = new HashMap<>(); @@ -4956,8 +4938,7 @@ public class SelfStationServiceImpl implements ISelfStationService { } @Override - @DS("ora") - @Transactional(propagation = Propagation.REQUIRES_NEW) + @Transactional public Result saveToDB(String fileName, HttpServletRequest request) { Result result = new Result(); String userName = JwtUtil.getUserNameByToken(request); @@ -5041,18 +5022,14 @@ public class SelfStationServiceImpl implements ISelfStationService { String qcTmpPath = selfStationData.getQcTmpPath(); //根据sample文件名称模糊查询sampleId - String sampleFilePath = "", qcFilePath = "", detFilePath = ""; if (StringUtils.isNotBlank(sampleFilePathName) && StringUtils.isNotBlank(sampleFileName)) { - sampleFilePath = StrUtil.subBefore(sampleFilePathName, StringPool.SLASH, true); - sampleFilePathName = phdFileUtil.NameStandardBy(sampleFilePath, sampleFileName); + sampleFilePathName = phdFileUtil.NameStandardBy(sampleFileName, sampleStruct.system_type, sampleStruct.data_type); } if (StringUtils.isNotBlank(detFilePathName) && StringUtils.isNotBlank(detFileName)) { - detFilePath = StrUtil.subBefore(detFilePathName, StringPool.SLASH, true); - detFilePathName = phdFileUtil.NameStandardBy(detFilePath, detFileName); + detFilePathName = phdFileUtil.NameStandardBy(detFileName, detStruct.system_type, detStruct.data_type); } if (StringUtils.isNotBlank(qcFilePathName) && StringUtils.isNotBlank(qcFileName)) { - qcFilePath = StrUtil.subBefore(qcFilePathName, StringPool.SLASH, true); - qcFilePathName = phdFileUtil.NameStandardBy(qcFilePath, qcFileName); + qcFilePathName = phdFileUtil.NameStandardBy(qcFileName, qcStruct.system_type, qcStruct.data_type); } // 读取参数内容 @@ -5063,7 +5040,7 @@ public class SelfStationServiceImpl implements ISelfStationService { List> mdcInfoMaps = ListUtil.toList(mdcInfoMap1, mdcInfoMap2, mdcInfoMap3, mdcInfoMap4); // 根据文件名称查询对应的sampleId 如果存在则赋值sampleId, Status 如果不存在则先存储数据信息到sampleData - PHDFile phd = new PHDFile(); + PHDFile phd = sampleVueData.getROIOnePHDFile(); BeanUtils.copyProperties(phdFiles.get(0), phd); GardsSampleDataSpectrum sampleData = spectrumAnalysisMapper.findSampleByFilePath(sampleInputFileName); if (ObjectUtil.isNotNull(sampleData)) { @@ -5089,7 +5066,7 @@ public class SelfStationServiceImpl implements ISelfStationService { } qcId = spectrumAnalysisMapper.getSampleId(qcFilePathName); } - sampleData = spectrumAnalysisMapper.findSampleByFilePath(sampleInputFileName); + sampleData = spectrumAnalysisMapper.findSampleByFilePath(sampleFilePathName); } sampleId = sampleData.getSampleId(); // 根据sampleId 查询idAnalysis @@ -5138,7 +5115,7 @@ public class SelfStationServiceImpl implements ISelfStationService { // 向 RNMAN.GARDS_NUCL_IDED 表写入被识别核素的活度浓度信息 analysisManService.saveNuclIdedROI(sampleId, idAnalysis); // 向 RNMAN.GARDS_QC_CHECK 表写入 QC 检查结果 - //analysisManService.saveQcCheckROI(sampleId, null); +// analysisManService.saveQcCheckROI(sampleId, null); // 向 RNMAN.GARDS_ANALY_SETTING 表写入 SpecSetup 分析参数设置 analysisManService.saveAnalySettingROI(sampleId, idAnalysis, phdFiles); // 向 RNMAN.GARDS_MDC 表写入 MDC计算结果 @@ -5297,7 +5274,6 @@ public class SelfStationServiceImpl implements ISelfStationService { @Override - @DS("ora") public Result viewARR(Integer sampleId, HttpServletResponse response) { GardsAnalyses analyses = spectrumAnalysisMapper.viewARRSelf(sampleId); Map result = new HashMap<>(); @@ -5355,7 +5331,6 @@ public class SelfStationServiceImpl implements ISelfStationService { } @Override - @DS("ora") public Result viewAutomaticAnalysisLog(Integer sampleId) { GardsAnalyses analyses = spectrumAnalysisMapper.viewLogSelf(sampleId); Map result = new HashMap<>();