diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/ConfigureData.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/ConfigureData.java index 78184b7e..02ed1e92 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/ConfigureData.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/ConfigureData.java @@ -46,4 +46,6 @@ public class ConfigureData implements Serializable { @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8") private Date refTime_conc; + private boolean applyAll; + } diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/NuclideLines.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/NuclideLines.java index ce7a3716..1ddf5c59 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/NuclideLines.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/NuclideLines.java @@ -12,6 +12,7 @@ public class NuclideLines implements Serializable { public List venergy; // 核素的所有γ射线能量 public List vuncertE; + public List vyield; // 核素γ射线分支比 public List vuncertY; diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/StatisticsQueryData.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/StatisticsQueryData.java index 23e59bcf..6c0df72e 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/StatisticsQueryData.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/entity/vo/StatisticsQueryData.java @@ -27,6 +27,8 @@ public class StatisticsQueryData implements Serializable { private boolean filterGrpbox; + private boolean xeResultFlag; + private List nuclidesList; private String minCollectTimeLine; 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 d2bd52d1..3d702e7b 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 @@ -252,10 +252,13 @@ and round(to_number(gsd.COLLECT_STOP-gsd.COLLECT_START)*24,2) BETWEEN #{statisticsQueryData.minCollectTimeLine} and #{statisticsQueryData.maxCollectTimeLine} and ROUND(GSD.ACQUISITION_LIVE_SEC/60/60.00,2) BETWEEN #{statisticsQueryData.minAcqLiveLine} and #{statisticsQueryData.maxAcqLiveLine} - and GSD.QUANTITY>#{statisticsQueryData.quantityLine} - and gsa.xe_volume>#{statisticsQueryData.xeVolumeLine} - and gxr.mdc>#{statisticsQueryData.mdcLine} - and gxr.conc>#{statisticsQueryData.concLine} + and GSD.QUANTITY > #{statisticsQueryData.quantityLine} + and gsa.xe_volume > #{statisticsQueryData.xeVolumeLine} + and gxr.mdc > #{statisticsQueryData.mdcLine} + and gxr.conc > #{statisticsQueryData.concLine} + + and GXR.NID_FLAG = 1 + and gsd.SITE_DET_CODE IN ('') diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java index ece76ca4..da35bf3b 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GammaServiceImpl.java @@ -172,7 +172,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi } // 从数据库中读取phd其他相关信息 boolean bRet = getResultFromDB(dbName, analyst, sampleId, phd, result); - if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) { + if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()+"-list")) { // 查询当前用户关联的核素信息 List userLib = new LinkedList<>(); // 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的 @@ -182,6 +182,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi } userLib = userLib.stream().sorted().collect(Collectors.toList()); Map nuclideMap = GetNuclideLines(userLib); + redisUtil.set(userName+"-"+phd.getHeader().getSystem_type()+"-list", userLib); redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap); } // 判断数据库信息是否读取正常 @@ -198,7 +199,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi if (!bRet) { return result; } - if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) { + if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()+"-list")) { // 查询当前用户关联的核素信息 List userLib = new LinkedList<>(); // 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的 @@ -208,6 +209,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi } userLib = userLib.stream().sorted().collect(Collectors.toList()); Map nuclideMap = GetNuclideLinesLocal(userLib); + redisUtil.set(userName+"-"+phd.getHeader().getSystem_type()+"-list", userLib); redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap); } key = fileName + "-" + userName; @@ -470,7 +472,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi } // 从数据库中读取phd其他相关信息 boolean bRet = getResultFromDB(dbName, analyst, sampleId, phd, result); - if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) { + if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()+"-list")) { // 查询当前用户关联的核素信息 List userLib = new LinkedList<>(); // 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的 @@ -480,6 +482,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi } userLib = userLib.stream().sorted().collect(Collectors.toList()); Map nuclideMap = GetNuclideLines(userLib); + redisUtil.set(userName+"-"+phd.getHeader().getSystem_type()+"-list", userLib); redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap); } // 判断数据库信息是否读取正常 @@ -836,7 +839,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi if (!bRet) { return result; } - if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type())) { + if (!redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()) || !redisUtil.hasKey(userName+"-"+phd.getHeader().getSystem_type()+"-list")) { // 查询当前用户关联的核素信息 List userLib = new LinkedList<>(); // 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的 @@ -845,7 +848,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); } userLib = userLib.stream().sorted().collect(Collectors.toList()); - Map nuclideMap = GetNuclideLinesLocal(userLib);//GetNuclideLinesLocal(userLib); + Map nuclideMap = GetNuclideLinesLocal(userLib); + redisUtil.set(userName+"-"+phd.getHeader().getSystem_type()+"-list", userLib); redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap); } } @@ -998,26 +1002,52 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi String userName = JwtUtil.getUserNameByToken(request); String fileName = configureData.getFileName(); Cache phdCache = localCache.getPHDCache(); - PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName); - if (Objects.isNull(phd)) { - result.error500("Please select the parse file first!"); - return result; + if (configureData.isApplyAll()) { + for (String key: phdCache.asMap().keySet()) { + PHDFile phd = phdCache.getIfPresent(key); + if (Objects.isNull(phd)) { + result.error500("Please select the parse file first!"); + return result; + } + SpecSetup phdSetting = phd.getSetting(); + phdSetting.setECutAnalysis_Low(configureData.getECutAnalysis_Low()); + phdSetting.setECutAnalysis_High(configureData.getECutAnalysis_High()); + phdSetting.setEnergyTolerance(configureData.getEnergyTolerance()); + phdSetting.setPss_low(configureData.getPss_low()); + phdSetting.setBaseImprovePSS(configureData.getBaseImprovePSS()); + phdSetting.setK_back(configureData.getK_back()); + phdSetting.setK_alpha(configureData.getK_alpha()); + phdSetting.setK_beta(configureData.getK_beta()); + phdSetting.setRiskLevelK(configureData.getRiskLevelK()); + phdSetting.setBUpdateCal(configureData.isUpdateCalibration()); + phdSetting.setKeepCalPeakSearchPeaks(configureData.isKeepCalPeakSearchPeaks()); + phdSetting.setRefTime_act(configureData.getRefTime_act()); + phdSetting.setRefTime_conc(configureData.getRefTime_conc()); + } + PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName); + map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal()); + } else { + PHDFile phd = phdCache.getIfPresent(fileName + "-" + userName); + if (Objects.isNull(phd)) { + result.error500("Please select the parse file first!"); + return result; + } + SpecSetup phdSetting = phd.getSetting(); + phdSetting.setECutAnalysis_Low(configureData.getECutAnalysis_Low()); + phdSetting.setECutAnalysis_High(configureData.getECutAnalysis_High()); + phdSetting.setEnergyTolerance(configureData.getEnergyTolerance()); + phdSetting.setPss_low(configureData.getPss_low()); + phdSetting.setBaseImprovePSS(configureData.getBaseImprovePSS()); + phdSetting.setK_back(configureData.getK_back()); + phdSetting.setK_alpha(configureData.getK_alpha()); + phdSetting.setK_beta(configureData.getK_beta()); + phdSetting.setRiskLevelK(configureData.getRiskLevelK()); + phdSetting.setBUpdateCal(configureData.isUpdateCalibration()); + phdSetting.setKeepCalPeakSearchPeaks(configureData.isKeepCalPeakSearchPeaks()); + phdSetting.setRefTime_act(configureData.getRefTime_act()); + phdSetting.setRefTime_conc(configureData.getRefTime_conc()); + map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal()); } - SpecSetup phdSetting = phd.getSetting(); - phdSetting.setECutAnalysis_Low(configureData.getECutAnalysis_Low()); - phdSetting.setECutAnalysis_High(configureData.getECutAnalysis_High()); - phdSetting.setEnergyTolerance(configureData.getEnergyTolerance()); - phdSetting.setPss_low(configureData.getPss_low()); - phdSetting.setBaseImprovePSS(configureData.getBaseImprovePSS()); - phdSetting.setK_back(configureData.getK_back()); - phdSetting.setK_alpha(configureData.getK_alpha()); - phdSetting.setK_beta(configureData.getK_beta()); - phdSetting.setRiskLevelK(configureData.getRiskLevelK()); - phdSetting.setBUpdateCal(configureData.isUpdateCalibration()); - phdSetting.setKeepCalPeakSearchPeaks(configureData.isKeepCalPeakSearchPeaks()); - phdSetting.setRefTime_act(configureData.getRefTime_act()); - phdSetting.setRefTime_conc(configureData.getRefTime_conc()); - map.put("checkBox_updateCal", phd.getSetting().isBUpdateCal()); result.success("Save successfully"); result.setResult(map); return result; @@ -1653,16 +1683,32 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi } int index = gammaFileUtil.FindNearPeak(phd.getVPeak(), channel, false); - // 查询当前用户关联的核素信息 - List userLib = new LinkedList<>(); - // 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的 - userLib = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase()); - if (CollectionUtils.isEmpty(userLib)) { - userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); - } + //获取缓存的核素信息 + Map nuclideMap = (Map) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type()); + //计算核素范围的最小能量值 double min = phd.getVPeak().get(index).energy - phd.getSetting().getEnergyTolerance(); + //计算核素范围的最大能量值 double max = phd.getVPeak().get(index).energy + phd.getSetting().getEnergyTolerance(); - List list_possible = spectrumAnalysisMapper.getPossibleNuclide(userLib, min, max); + //声明返回的数组内容 + List list_possible = new LinkedList<>(); + //判断缓存的核素信息是否为空 + if (CollectionUtils.isNotEmpty(nuclideMap)) { + //遍历核素信息 + for (Map.Entry entry:nuclideMap.entrySet()) { + //获取核素的关联信息 + NuclideLines nuclideLines = entry.getValue(); + //获取核素关联的全部能量信息 + List venergy = nuclideLines.getVenergy(); + //遍历能量 + for (int i=0; i min && venergy.get(i) < max) { + list_possible.add(entry.getKey()); + break; + } + } + } + } // 用户当前已选中的核素名称 List list_identify = phd.getVPeak().get(index).nuclides; @@ -1699,7 +1745,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi // 根据要进行修改的列的数据下标 操作Vpeak数据 phd.getVPeak().get(curRow).nuclides.add(nuclideName); // 查询当前用户所关心的核素名称 - Map mapNucLines = (Map) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type());//GetNuclideLines(userLib); + Map mapNucLines = (Map) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type()); // 查询出核素信息 NuclideLines it_line = mapNucLines.get(nuclideName); // 如果核素信息不存在返回 @@ -1884,14 +1930,30 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi BigDecimal bigDecimal = BigDecimal.valueOf(value); bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP); map.put("energy", bigDecimal); - // 查询当前用户关联的核素信息 - List nuclides = new LinkedList<>(); - // 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的 - nuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase()); - if (CollectionUtils.isEmpty(nuclides)) { - nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); + //返回的核素列信息 + List nuclideList = new LinkedList<>(); + double min = bigDecimal.doubleValue() - 0.5; + double max = bigDecimal.doubleValue() + 0.5; + //获取缓存的核素信息 + Map nuclideMap = (Map) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type()); + //判断缓存的核素信息是否为空 + if (CollectionUtils.isNotEmpty(nuclideMap)) { + //遍历核素信息 + for (Map.Entry entry:nuclideMap.entrySet()) { + //获取核素的关联信息 + NuclideLines nuclideLines = entry.getValue(); + //获取核素关联的全部能量信息 + List venergy = nuclideLines.getVenergy(); + //遍历能量 + for (int i=0; i min && venergy.get(i) < max) { + nuclideList.add(entry.getKey()); + break; + } + } + } } - List nuclideList = InitList(bigDecimal.doubleValue(), 0.5, nuclides); if (CollectionUtils.isNotEmpty(nuclideList)) { map.put("list", nuclideList); String name = nuclideList.get(0); @@ -1910,15 +1972,15 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi return result; } - public List InitList(double energy, double tolerance, List nuclides) { - if (nuclides.size() < 1) { - return new LinkedList<>(); - } - double min = energy - tolerance; - double max = energy + tolerance; - List nuclideList = spectrumAnalysisMapper.findNuclideList(min, max, nuclides); - return nuclideList; - } +// public List InitList(double energy, double tolerance, List nuclides) { +// if (nuclides.size() < 1) { +// return new LinkedList<>(); +// } +// double min = energy - tolerance; +// double max = energy + tolerance; +// List nuclideList = spectrumAnalysisMapper.findNuclideList(min, max, nuclides); +// return nuclideList; +// } public void InitTable(String name, Map map, PHDFile phd, Map colorMap) { InitNuclideInfo(name, map); @@ -2017,14 +2079,30 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi BigDecimal bigDecimal = BigDecimal.valueOf(energy); bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP); map.put("energy", bigDecimal); - // 查询当前用户关联的核素信息 - List nuclides = new LinkedList<>(); - // 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的 - nuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase()); - if (CollectionUtils.isEmpty(nuclides)) { - nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); + //返回的核素列信息 + List nuclideList = new LinkedList<>(); + double min = bigDecimal.doubleValue() - tolerance; + double max = bigDecimal.doubleValue() + tolerance; + //获取缓存的核素信息 + Map nuclideMap = (Map) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type()); + //判断缓存的核素信息是否为空 + if (CollectionUtils.isNotEmpty(nuclideMap)) { + //遍历核素信息 + for (Map.Entry entry:nuclideMap.entrySet()) { + //获取核素的关联信息 + NuclideLines nuclideLines = entry.getValue(); + //获取核素关联的全部能量信息 + List venergy = nuclideLines.getVenergy(); + //遍历能量 + for (int i=0; i min && venergy.get(i) < max) { + nuclideList.add(entry.getKey()); + break; + } + } + } } - List nuclideList = InitList(bigDecimal.doubleValue(), tolerance, nuclides); if (CollectionUtils.isNotEmpty(nuclideList)) { map.put("list", nuclideList); String name = nuclideList.get(0); @@ -3433,12 +3511,26 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi double min = editEnergyDou - err; double max = editEnergyDou + err; if (libraryName.equals("UserLibrary")) { - // 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的 - nuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase()); - if (CollectionUtils.isEmpty(nuclides)) { - nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); + //获取缓存的核素信息 + Map nuclideMap = (Map) redisUtil.get(userName+"-"+phd.getHeader().getSystem_type()); + //判断缓存的核素信息是否为空 + if (CollectionUtils.isNotEmpty(nuclideMap)) { + //遍历核素信息 + for (Map.Entry entry:nuclideMap.entrySet()) { + //获取核素的关联信息 + NuclideLines nuclideLines = entry.getValue(); + //获取核素关联的全部能量信息 + List venergy = nuclideLines.getVenergy(); + //遍历能量 + for (int i=0; i min && venergy.get(i) < max) { + nuclides.add(entry.getKey()); + break; + } + } + } } - nuclides = spectrumAnalysisMapper.getUserNuclideNames(nuclides, min, max); } else if (libraryName.equals("FULLLibrary")) { nuclides = spectrumAnalysisMapper.getFULLNuclideNames(min, max); } else if (libraryName.equals("RelevantLibrary")) { @@ -3446,11 +3538,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi } } else { if (libraryName.equals("UserLibrary")) { - // 从postgreSql中获取当前用户关注的核素信息 如果当前用户没有 则返回管理员的 - nuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase()); - if (CollectionUtils.isEmpty(nuclides)) { - nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); - } + //redis中获取缓存的用户关注核素信息 + nuclides = (List)redisUtil.get(userName+"-"+phd.getHeader().getSystem_type()+"-list"); } else if (libraryName.equals("FULLLibrary")) { nuclides = spectrumAnalysisMapper.getNuclideNames("CONFIGURATION.GARDS_NUCL_LIB"); } else if (libraryName.equals("RelevantLibrary")) { @@ -3581,10 +3670,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi return result; } List nuclides = spectrumAnalysisMapper.getNuclideNames("CONFIGURATION.GARDS_NUCL_LIB"); - List userNuclides = defaultNuclideSpectrumService.findNuclidesByUserName(userName, phd.getHeader().getSystem_type().toUpperCase()); - if (CollectionUtils.isEmpty(userNuclides)) { - userNuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); - } + //redis中获取缓存的用户关注核素信息 + List userNuclides = (List)redisUtil.get(userName+"-"+phd.getHeader().getSystem_type()+"-list"); map.put("AllNuclides", nuclides); map.put("UserNuclides", userNuclides); result.setSuccess(true); @@ -3618,6 +3705,7 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi userLib = defaultNuclideSpectrumService.findNuclidesByUserName("admin", phd.getHeader().getSystem_type().toUpperCase()); } Map nuclideMap = GetNuclideLines(userLib); + redisUtil.set(userName+"-"+phd.getHeader().getSystem_type()+"-list", userLib); redisUtil.set(userName+"-"+phd.getHeader().getSystem_type(), nuclideMap); } else { result.success("Modification failure!");