From b48cf5a99130c0a385342536d6ae0bc4fa2d3856 Mon Sep 17 00:00:00 2001 From: nieziyan Date: Wed, 31 Jul 2024 18:23:32 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E8=87=AA=E5=BB=BA=E5=8F=B0?= =?UTF-8?q?=E7=AB=99loadFromDB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/modules/base/dto/RoiDto.java | 12 ++++ .../modules/service/AnalysisManService.java | 2 +- .../service/impl/AnalysisManServiceImpl.java | 8 ++- .../mapper/SpectrumAnalysisMapper.java | 3 + .../mapper/xml/SpectrumAnalysisMapper.xml | 3 + .../service/impl/SelfStationServiceImpl.java | 64 ++++++++++++++++--- 6 files changed, 80 insertions(+), 12 deletions(-) create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/RoiDto.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/RoiDto.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/RoiDto.java new file mode 100644 index 00000000..7f64b183 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/dto/RoiDto.java @@ -0,0 +1,12 @@ +package org.jeecg.modules.base.dto; + +import lombok.Data; + +@Data +public class RoiDto { + + private Integer roiNum; + + private String phdPath; + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/AnalysisManService.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/AnalysisManService.java index a8af0937..d9969ddf 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/AnalysisManService.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/AnalysisManService.java @@ -47,7 +47,7 @@ public interface AnalysisManService { void saveQcCheckROI(Integer sampleId, Map qcItems, Integer idAnalysis); - void saveMDCROI(Integer sampleId, Map mdcInfoMap, Integer idAnalysis); + void saveMDCROI(Integer sampleId, List> mdcInfoMaps, Integer idAnalysis); void saveAnalySettingROI(Integer sampleId, Integer idAnalysis, List phdFiles); } diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/AnalysisManServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/AnalysisManServiceImpl.java index 249529e9..fb9f8ab1 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/AnalysisManServiceImpl.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/AnalysisManServiceImpl.java @@ -489,10 +489,12 @@ public class AnalysisManServiceImpl implements AnalysisManService { } @Override - public void saveMDCROI(Integer sampleId, Map mdcInfoMap, Integer idAnalysis){ + public void saveMDCROI(Integer sampleId, List> mdcInfoMaps, Integer idAnalysis){ List mdcRois = new ArrayList<>(); - Set roiIds = this.middleDataMap.keySet(); - for (Integer roiId : roiIds) { + List roiIds = ListUtil.toList(this.middleDataMap.keySet()); + for (int i = 0; i < roiIds.size(); i++) { + Integer roiId = roiIds.get(i); + Map mdcInfoMap = mdcInfoMaps.get(i); mdcRois.addAll(saveMDCROI(sampleId, idAnalysis, roiId, mdcInfoMap)); } mdcRoiManService.saveBatch(mdcRois); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/SpectrumAnalysisMapper.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/SpectrumAnalysisMapper.java index a43bad2e..68c335d1 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/SpectrumAnalysisMapper.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/SpectrumAnalysisMapper.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.base.dto.RoiDto; import org.jeecg.modules.base.entity.configuration.GardsDetectors; import org.jeecg.modules.base.entity.configuration.GardsNuclLib; import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib; @@ -86,6 +87,8 @@ public interface SpectrumAnalysisMapper { Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName); + List roiPaths(@Param("dbName") String dbName, @Param("analysisId") Integer analysisId); + List ReadGammaFitChannelEnergy(@Param(value = "idAnalysis") Integer idAnalysis); List ReadGammaCalibrationParam(@Param(value = "dbName") String dbName, @Param(value = "idAnalysis") Integer idAnalysis); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/xml/SpectrumAnalysisMapper.xml b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/xml/SpectrumAnalysisMapper.xml index d41dab5d..d0ce75eb 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/xml/SpectrumAnalysisMapper.xml +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/mapper/xml/SpectrumAnalysisMapper.xml @@ -1104,5 +1104,8 @@ + \ No newline at end of file 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 52672228..6b0e9101 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.dto.RoiDto; import org.jeecg.modules.base.entity.configuration.GardsNuclLib; import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib; import org.jeecg.modules.base.entity.original.GardsSampleData; @@ -65,6 +66,8 @@ import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; +import static org.aspectj.weaver.tools.cache.SimpleCacheFactory.path; + @Service public class SelfStationServiceImpl implements ISelfStationService { @@ -131,6 +134,7 @@ public class SelfStationServiceImpl implements ISelfStationService { } @Override + @DS("ora") public Result loadFromDB(String dbName, Integer sampleId, String analyst, HttpServletRequest request) { Result result = new Result(); Map> resultMap = new HashMap<>(); @@ -143,14 +147,18 @@ public class SelfStationServiceImpl implements ISelfStationService { result.error500("Please select a piece of data"); return result; } + String prefix = spectrumPathProperties.getRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH; //查询分析id,相关的分析结果 Integer analysisID = null; + List roiPaths = new ArrayList<>(); if (dbName.equalsIgnoreCase("auto")){ dbName = "RNAUTO"; analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO"); + roiPaths = spectrumAnalysisMapper.roiPaths(dbName, analysisID); } else if (dbName.equalsIgnoreCase("man")){ dbName = "RNMAN"; analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, analyst); + roiPaths = spectrumAnalysisMapper.roiPaths(dbName, analysisID); } try { if (Objects.nonNull(analysisID)) { @@ -173,14 +181,14 @@ public class SelfStationServiceImpl implements ISelfStationService { detFileName = dbSpectrumFilePath.getDetBgFilePath().substring(dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)+1); } //从缓存中获取公用变量的数据 - SelfStationData selfStationData = selfCache.getIfPresent(sampleFileName + "-" + userName); + SelfStationData selfStationData = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName); if (Objects.isNull(selfStationData)) { //初始化自建台站数据对象 selfStationData = new SelfStationData(); //判断sample文件名是否为空 if (Objects.nonNull(sample)) { //拼接sample文件路径 - String sampleFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath(); + String sampleFilePath = prefix + dbSpectrumFilePath.getSampleFilePath(); //返回结果map Map map = new HashMap<>(); //获取sample分析后的对象 @@ -190,12 +198,15 @@ public class SelfStationServiceImpl implements ISelfStationService { selfStationData.setSampleTmpPath(sampleFilePath); selfStationUtil.loadFile(selfStationData, sample.getSampleId(), sample.getStatus(), "sample", map); resultMap.put("sample", map); + + // 返回Beta和Gamma的数据 + bGSpectrum(struct, map); } } //判断det文件名是否为空 if (Objects.nonNull(detBg)) { //拼接det文件路径 - String detFilePath = ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath(); + String detFilePath = prefix + dbSpectrumFilePath.getDetBgFilePath(); //返回结果map Map map = new HashMap<>(); //获取sample分析后的对象 @@ -233,13 +244,45 @@ public class SelfStationServiceImpl implements ISelfStationService { redisUtil.set(userName+StringPool.DASH+systemType+"-list-self", userLib); redisUtil.set(userName+StringPool.DASH+systemType+"-self", nuclideMap); } + // 将四个Gamma ROI文件对象放到缓存中 + SelfStationVueData sampleVueData = selfStationData.getSampleVueData(); + + Map roiPathMap = roiPaths.stream() + .collect(Collectors.toMap(RoiDto::getRoiNum, RoiDto::getPhdPath)); + + String fullPath1 = prefix + roiPathMap.get(1); + String fullPath2 = prefix + roiPathMap.get(2); + String fullPath3 = prefix + roiPathMap.get(3); + String fullPath4 = prefix + roiPathMap.get(4); + + String name1 = FileUtil.getName(fullPath1); + String name2 = FileUtil.getName(fullPath2); + String name3 = FileUtil.getName(fullPath3); + String name4 = FileUtil.getName(fullPath4); + + String path = fullPath1.substring(0, fullPath1.lastIndexOf(StrUtil.SLASH)); + + sampleVueData.setROIOneFileName(name1); + sampleVueData.setROIOnePHDFile(selfStationUtil.getGammaPHD(name1, path)); + sampleVueData.setROITwoFileName(name2); + sampleVueData.setROITwoPHDFile(selfStationUtil.getGammaPHD(name2, path)); + sampleVueData.setROIThreeFileName(name3); + sampleVueData.setROIThreePHDFile(selfStationUtil.getGammaPHD(name3, path)); + sampleVueData.setROIFourFileName(name4); + sampleVueData.setROIFourPHDFile(selfStationUtil.getGammaPHD(name4, path)); } + //将自建台站的数据封装到缓存对象中 + selfCache.put(sampleFileName + StringPool.DASH + userName, selfStationData); + //将缓存对象存入到缓存中 + selfStationCache.setSelfCache(selfCache); } else { if (Objects.nonNull(sample)) { //返回结果map Map map = new HashMap<>(); selfStationUtil.loadFile(selfStationData, sample.getSampleId(), sample.getStatus(), "sample", map); resultMap.put("sample", map); + // 返回Beta和Gamma的数据 + bGSpectrum(selfStationData.getSampleStruct(), map); } if (Objects.nonNull(detBg)) { //返回结果map @@ -251,9 +294,10 @@ public class SelfStationServiceImpl implements ISelfStationService { } } } catch (Exception e) { - + e.printStackTrace(); } - + result.setSuccess(true); + result.setResult(resultMap); return result; } @@ -513,7 +557,6 @@ public class SelfStationServiceImpl implements ISelfStationService { seriseData.setY(gCounts.get(i)); seriseDataG.add(seriseData); } - Map result = new HashMap<>(); map.put("bSpectrum", seriseDataB); map.put("gSpectrum", seriseDataG); } @@ -4087,7 +4130,12 @@ public class SelfStationServiceImpl implements ISelfStationService { String path4 = savePathName + StrUtil.SLASH + phdFile4.getFilename(); List phdFilePaths = ListUtil.toList(path1, path2, path3, path4); //读取参数内容 - Map mdcInfoMap = phdFile1.getMdcInfoMap(); + Map mdcInfoMap1 = phdFile1.getMdcInfoMap(); + Map mdcInfoMap2 = phdFile1.getMdcInfoMap(); + Map mdcInfoMap3 = phdFile1.getMdcInfoMap(); + Map mdcInfoMap4 = phdFile1.getMdcInfoMap(); + List> mdcInfoMaps = ListUtil.toList(mdcInfoMap1, mdcInfoMap2, + mdcInfoMap3, mdcInfoMap4); bRet = gammaFileUtil.GetInterMiddlData(phdFiles, userName, middleDatas, "save"); if (!bRet) { @@ -4161,7 +4209,7 @@ public class SelfStationServiceImpl implements ISelfStationService { // 向 RNMAN.GARDS_ANALY_SETTING 表写入 SpecSetup 分析参数设置 analysisManService.saveAnalySettingROI(sampleId, idAnalysis, phdFiles); // 向 RNMAN.GARDS_MDC 表写入 MDC计算结果 - analysisManService.saveMDCROI(sampleId, mdcInfoMap, idAnalysis); + analysisManService.saveMDCROI(sampleId, mdcInfoMaps, idAnalysis); if (bRet) { phd.setStatus("R"); //分析成功后存储日志文件和报告文件