From 82713a879582a28d35efc7c4a0c0d86f744a9525 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Thu, 18 Jan 2024 10:33:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=BB=BA=E5=8F=B0=E7=AB=99=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=AE=9E=E4=BD=93=E7=B1=BB=E5=AD=98=E5=82=A8=E5=85=AC?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E6=95=B0=E6=8D=AE=E5=86=85=E5=AE=B9=20?= =?UTF-8?q?=E8=87=AA=E5=BB=BA=E5=8F=B0=E7=AB=99=E8=BF=94=E5=9B=9E=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E5=A2=9E=E5=8A=A0det=E7=9B=B8=E5=85=B3=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=20web=E6=A8=A1=E5=9D=97=E5=A2=9E=E5=8A=A0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E7=B3=BB=E7=BB=9F=E7=B1=BB=E5=9E=8B=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE=E6=A0=B8=E7=B4=A0=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=20web=E6=A8=A1=E5=9D=97=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=B1=BB=E5=9E=8B=E5=AF=B9=E5=BA=94=E7=9A=84?= =?UTF-8?q?=E6=A0=B8=E7=B4=A0=E7=BB=9F=E8=AE=A1=E4=BF=A1=E6=81=AF=20?= =?UTF-8?q?=E4=BA=BA=E5=B7=A5=E4=BA=A4=E4=BA=92=E6=A8=A1=E5=9D=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0beta=E9=83=A8=E5=88=86=E6=97=A5=E5=BF=97=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=AD=98=E5=9C=A8=E6=83=85=E5=86=B5=E5=88=A4?= =?UTF-8?q?=E6=96=AD=EF=BC=8C=E4=B8=8A=E4=BC=A0=E5=90=8E=E7=9A=84=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=96=87=E4=BB=B6=E4=B8=8D=E8=BF=9B=E8=A1=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jeecg/common/util/SelfStationUtil.java | 223 ++++++++------ .../modules/entity/vo/SelfStationData.java | 99 +----- .../modules/entity/vo/SelfStationVueData.java | 115 +++++++ .../service/impl/SelfStationServiceImpl.java | 144 ++++----- .../impl/SpectrumAnalysisServiceImpl.java | 10 +- .../controller/WebStatisticsController.java | 18 ++ .../mapper/GardsSampleDataWebMapper.java | 3 + .../mapper/SysDefaultNuclideMapper.java | 9 + .../mapper/xml/GardsSampleDataWebMapper.xml | 44 +++ .../service/IGardsSampleDataWebService.java | 5 + .../impl/GardsSampleDataWebServiceImpl.java | 284 ++++++++++++++++-- 11 files changed, 678 insertions(+), 276 deletions(-) create mode 100644 jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/SelfStationVueData.java create mode 100644 jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysDefaultNuclideMapper.java 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 a9a5d0e3..5ae201a7 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 @@ -24,12 +24,19 @@ public class SelfStationUtil extends AbstractLogOrReport { @Autowired private FTPUtil ftpUtil; - public void loadFile(SelfStationData selfStationData, Integer sampleId, String status, Map map) { + public void loadFile(SelfStationData selfStationData, Integer sampleId, String status, String systemType, Map map) { try { - //读取sample的分析文件内容 - EnergySpectrumStruct struct = selfStationData.getSampleStruct(); - SpectrumData spectrumData = new SpectrumData(); + EnergySpectrumStruct struct = null; + if (systemType.equals("sample")) { + //读取sample的分析文件内容 + struct = selfStationData.getSampleStruct(); + } else if (systemType.equals("det")) { + struct = selfStationData.getDetStruct(); + } + //存储页面操作数据 + SelfStationVueData selfStationVueData = new SelfStationVueData(); //封装散点图下的基础数据信息 + SpectrumData spectrumData = new SpectrumData(); //Station Code String stationCode = struct.site_code; //Detector Code @@ -91,36 +98,80 @@ public class SelfStationUtil extends AbstractLogOrReport { spectrumData.setMeasurementId(measurementId); map.put("spectrumData", spectrumData); //根据范围1划分 范围1对应的折线图 - statisticsROIList(struct.POI_B_x1.get(0).intValue(), struct.POI_B_x2.get(0).intValue(), 1, selfStationData); - if ( CollectionUtils.isNotEmpty(selfStationData.getROIOneList()) && Objects.nonNull(selfStationData.getROIOneBetaStart()) - && Objects.nonNull(selfStationData.getROIOneBetaStop()) ) { - map.put("ROIOneList", selfStationData.getROIOneList()); - map.put("ROIOneStart", selfStationData.getROIOneBetaStart()); - map.put("ROIOneStop", selfStationData.getROIOneBetaStop()); + Map oneMap = statisticsROIList(struct.POI_B_x1.get(0).intValue(), struct.POI_B_x2.get(0).intValue(), struct.b_channels, struct.g_channels, struct.h_counts); + if (CollectionUtils.isNotEmpty(oneMap) ) { + Integer startChannel = (Integer) oneMap.get("startChannel"); + Integer endChannel = (Integer) oneMap.get("endChannel"); + List seriseDataList = (List) oneMap.get("dataList"); + if (systemType.equals("sample")) { + selfStationData.getSampleVueData().setROIOneBetaStart(startChannel); + selfStationData.getSampleVueData().setROIOneBetaStop(endChannel); + selfStationData.getSampleVueData().setROIOneList(seriseDataList); + } else if (systemType.equals("det")) { + selfStationData.getDetVueData().setROIOneBetaStart(startChannel); + selfStationData.getDetVueData().setROIOneBetaStop(endChannel); + selfStationData.getDetVueData().setROIOneList(seriseDataList); + } + map.put("ROIOneStart", startChannel); + map.put("ROIOneStop", endChannel); + map.put("ROIOneList", seriseDataList); } //根据范围2划分 范围2对应的折线图 - statisticsROIList(struct.POI_B_x1.get(1).intValue(), struct.POI_B_x2.get(1).intValue(), 2, selfStationData); - if ( CollectionUtils.isNotEmpty(selfStationData.getROITwoList()) && Objects.nonNull(selfStationData.getROITwoBetaStart()) - && Objects.nonNull(selfStationData.getROITwoBetaStop()) ) { - map.put("ROITwoList", selfStationData.getROITwoList()); - map.put("ROITwoStart", selfStationData.getROITwoBetaStart()); - map.put("ROITwoStop", selfStationData.getROITwoBetaStop()); + Map twoMap = statisticsROIList(struct.POI_B_x1.get(1).intValue(), struct.POI_B_x2.get(1).intValue(), struct.b_channels, struct.g_channels, struct.h_counts); + if ( CollectionUtils.isNotEmpty(twoMap) ) { + Integer startChannel = (Integer) twoMap.get("startChannel"); + Integer endChannel = (Integer) twoMap.get("endChannel"); + List seriseDataList = (List) twoMap.get("dataList"); + if (systemType.equals("sample")) { + selfStationData.getSampleVueData().setROITwoBetaStart(startChannel); + selfStationData.getSampleVueData().setROITwoBetaStop(endChannel); + selfStationData.getSampleVueData().setROITwoList(seriseDataList); + } else if (systemType.equals("det")) { + selfStationData.getDetVueData().setROITwoBetaStart(startChannel); + selfStationData.getDetVueData().setROITwoBetaStop(endChannel); + selfStationData.getDetVueData().setROITwoList(seriseDataList); + } + map.put("ROITwoStart", startChannel); + map.put("ROITwoStop", endChannel); + map.put("ROITwoList", seriseDataList); } //根据范围3划分 范围3对应的折线图 - statisticsROIList(struct.POI_B_x1.get(2).intValue(), struct.POI_B_x2.get(2).intValue(), 3, selfStationData); - if ( CollectionUtils.isNotEmpty(selfStationData.getROIThreeList()) && Objects.nonNull(selfStationData.getROIThreeBetaStart()) - && Objects.nonNull(selfStationData.getROIThreeBetaStop()) ) { - map.put("ROIThreeList", selfStationData.getROIThreeList()); - map.put("ROIThreeStart", selfStationData.getROIThreeBetaStart()); - map.put("ROIThreeStop", selfStationData.getROIThreeBetaStop()); + Map threeMap = statisticsROIList(struct.POI_B_x1.get(2).intValue(), struct.POI_B_x2.get(2).intValue(), struct.b_channels, struct.g_channels, struct.h_counts); + if ( CollectionUtils.isNotEmpty(threeMap) ) { + Integer startChannel = (Integer) threeMap.get("startChannel"); + Integer endChannel = (Integer) threeMap.get("endChannel"); + List seriseDataList = (List) threeMap.get("dataList"); + if (systemType.equals("sample")) { + selfStationData.getSampleVueData().setROIThreeBetaStart(startChannel); + selfStationData.getSampleVueData().setROIThreeBetaStop(endChannel); + selfStationData.getSampleVueData().setROIThreeList(seriseDataList); + } else if (systemType.equals("det")) { + selfStationData.getDetVueData().setROIThreeBetaStart(startChannel); + selfStationData.getDetVueData().setROIThreeBetaStop(endChannel); + selfStationData.getDetVueData().setROIThreeList(seriseDataList); + } + map.put("ROIThreeStart", startChannel); + map.put("ROIThreeStop", endChannel); + map.put("ROIThreeList", seriseDataList); } //根据范围4划分 范围4对应的折线图 - statisticsROIList(struct.POI_B_x1.get(3).intValue(), struct.POI_B_x2.get(3).intValue(), 4, selfStationData); - if ( CollectionUtils.isNotEmpty(selfStationData.getROIFourList()) && Objects.nonNull(selfStationData.getROIFourBetaStart()) - && Objects.nonNull(selfStationData.getROIFourBetaStop()) ) { - map.put("ROIFourList", selfStationData.getROIFourList()); - map.put("ROIFourStart", selfStationData.getROIFourBetaStart()); - map.put("ROIFourStop", selfStationData.getROIFourBetaStop()); + Map fourMap = statisticsROIList(struct.POI_B_x1.get(3).intValue(), struct.POI_B_x2.get(3).intValue(), struct.b_channels, struct.g_channels, struct.h_counts); + if ( CollectionUtils.isNotEmpty(fourMap) ) { + Integer startChannel = (Integer) fourMap.get("startChannel"); + Integer endChannel = (Integer) fourMap.get("endChannel"); + List seriseDataList = (List) fourMap.get("dataList"); + if (systemType.equals("sample")) { + selfStationData.getSampleVueData().setROIFourBetaStart(startChannel); + selfStationData.getSampleVueData().setROIFourBetaStop(endChannel); + selfStationData.getSampleVueData().setROIFourList(seriseDataList); + } else if (systemType.equals("det")) { + selfStationData.getDetVueData().setROIFourBetaStart(startChannel); + selfStationData.getDetVueData().setROIFourBetaStop(endChannel); + selfStationData.getDetVueData().setROIFourList(seriseDataList); + } + map.put("ROIFourStart", startChannel); + map.put("ROIFourStop", endChannel); + map.put("ROIFourList", seriseDataList); } //散点图 //统计散点图 @@ -186,51 +237,55 @@ public class SelfStationUtil extends AbstractLogOrReport { //g_Energy if (CollectionUtils.isNotEmpty(struct.g_energy) && CollectionUtils.isNotEmpty(struct.g_centroid_channel) && CollectionUtils.isNotEmpty(struct.g_uncertainty) && Objects.nonNull(struct.g_record_count)) { - GEnergyBlock gEnergyBlock = new GEnergyBlock(); - gEnergyBlock.setG_energy(struct.g_energy); - gEnergyBlock.setCentroid_channel(struct.g_centroid_channel); - gEnergyBlock.setUncertainty(struct.g_uncertainty); - gEnergyBlock.setRecord_count(struct.g_record_count); - selfStationData.getMapEnerKD().put(CalName.CalPHD.getType(), gEnergyBlock); - //计算得到公式的参数 - List calEnergyParam = CalValuesHandler.calFitPara("Cal_Energy", 2, struct.g_centroid_channel, struct.g_energy, struct.g_uncertainty); - ParameterInfo parameterInfo = new ParameterInfo(); - parameterInfo.setP(calEnergyParam); - selfStationData.getMapEnerPara().put(CalName.CalPHD.getType(), parameterInfo); + if (systemType.equals("sample")) { + GEnergyBlock gEnergyBlock = new GEnergyBlock(); + gEnergyBlock.setG_energy(struct.g_energy); + gEnergyBlock.setCentroid_channel(struct.g_centroid_channel); + gEnergyBlock.setUncertainty(struct.g_uncertainty); + gEnergyBlock.setRecord_count(struct.g_record_count); + selfStationData.getSampleVueData().getMapEnerKD().put(CalName.CalPHD.getType(), gEnergyBlock); + //计算得到公式的参数 + List calEnergyParam = CalValuesHandler.calFitPara("Cal_Energy", 2, struct.g_centroid_channel, struct.g_energy, struct.g_uncertainty); + ParameterInfo parameterInfo = new ParameterInfo(); + parameterInfo.setP(calEnergyParam); + selfStationData.getSampleVueData().getMapEnerPara().put(CalName.CalPHD.getType(), parameterInfo); + } } //g_Resolution if (CollectionUtils.isNotEmpty(struct.g_r_energy) && CollectionUtils.isNotEmpty(struct.g_r_FWHM) && CollectionUtils.isNotEmpty(struct.g_r_uncertainty) && Objects.nonNull(struct.g_r_record_count)) { - GResolutionBlock gResolutionBlock = new GResolutionBlock(); - gResolutionBlock.setG_energy(struct.g_r_energy); - gResolutionBlock.setFWHM(struct.g_r_FWHM); - gResolutionBlock.setUncertainty(struct.g_r_uncertainty); - gResolutionBlock.setRecord_count(struct.g_r_record_count); - selfStationData.getMapResoKD().put(CalName.CalPHD.getType(), gResolutionBlock); - //计算得到公式的参数 - List calEnergyParam = CalValuesHandler.calFitPara("Cal_Resolution", 4, struct.g_r_energy, struct.g_r_FWHM, struct.g_r_uncertainty); - ParameterInfo parameterInfo = new ParameterInfo(); - parameterInfo.setP(calEnergyParam); - selfStationData.getMapResoPara().put(CalName.CalPHD.getType(), parameterInfo); + if (systemType.equals("sample")) { + GResolutionBlock gResolutionBlock = new GResolutionBlock(); + gResolutionBlock.setG_energy(struct.g_r_energy); + gResolutionBlock.setFWHM(struct.g_r_FWHM); + gResolutionBlock.setUncertainty(struct.g_r_uncertainty); + gResolutionBlock.setRecord_count(struct.g_r_record_count); + selfStationData.getSampleVueData().getMapResoKD().put(CalName.CalPHD.getType(), gResolutionBlock); + //计算得到公式的参数 + List calEnergyParam = CalValuesHandler.calFitPara("Cal_Resolution", 4, struct.g_r_energy, struct.g_r_FWHM, struct.g_r_uncertainty); + ParameterInfo parameterInfo = new ParameterInfo(); + parameterInfo.setP(calEnergyParam); + selfStationData.getSampleVueData().getMapResoPara().put(CalName.CalPHD.getType(), parameterInfo); + } } //g_Efficiency if (CollectionUtils.isNotEmpty(struct.g_e_energy) && CollectionUtils.isNotEmpty(struct.g_e_efficiency) && CollectionUtils.isNotEmpty(struct.g_e_uncertainty) && Objects.nonNull(struct.g_e_record_count)) { - GEfficiencyBlock gEfficiencyBlock = new GEfficiencyBlock(); - gEfficiencyBlock.setG_energy(struct.g_e_energy); - gEfficiencyBlock.setEfficiency(struct.g_e_efficiency); - gEfficiencyBlock.setUncertainty(struct.g_e_uncertainty); - gEfficiencyBlock.setRecord_count(struct.g_e_record_count); - selfStationData.getMapEffiKD().put(CalName.CalPHD.getType(), gEfficiencyBlock); - //计算得到公式的参数 - List calEnergyParam = CalValuesHandler.calFitPara("Cal_Efficiency", 1, struct.g_e_energy, struct.g_e_efficiency, struct.g_e_uncertainty); - ParameterInfo parameterInfo = new ParameterInfo(); - parameterInfo.setP(calEnergyParam); - selfStationData.getMapEffiPara().put(CalName.CalPHD.getType(), parameterInfo); + if (systemType.equals("sample")) { + GEfficiencyBlock gEfficiencyBlock = new GEfficiencyBlock(); + gEfficiencyBlock.setG_energy(struct.g_e_energy); + gEfficiencyBlock.setEfficiency(struct.g_e_efficiency); + gEfficiencyBlock.setUncertainty(struct.g_e_uncertainty); + gEfficiencyBlock.setRecord_count(struct.g_e_record_count); + selfStationData.getSampleVueData().getMapEffiKD().put(CalName.CalPHD.getType(), gEfficiencyBlock); + //计算得到公式的参数 + List calEnergyParam = CalValuesHandler.calFitPara("Cal_Efficiency", 1, struct.g_e_energy, struct.g_e_efficiency, struct.g_e_uncertainty); + ParameterInfo parameterInfo = new ParameterInfo(); + parameterInfo.setP(calEnergyParam); + selfStationData.getSampleVueData().getMapEffiPara().put(CalName.CalPHD.getType(), parameterInfo); + } } - } catch (ParseException e) { throw new RuntimeException(e); } - } /** @@ -265,17 +320,12 @@ public class SelfStationUtil extends AbstractLogOrReport { * 统计道值范围内数量 * @param startChannel 起始道值 * @param endChannel 结束道值 - * @param num 第几个范围 - * @param selfStationData 自建台站对象 + * @param betaChannels 行数 + * @param gammaChannels 列数 + * @param h_counts 计数数组 */ - public void statisticsROIList(Integer startChannel, Integer endChannel, Integer num, SelfStationData selfStationData) { - EnergySpectrumStruct struct = selfStationData.getSampleStruct(); - //获取总行数信息 - long betaChannels = struct.b_channels; - //获取总列数信息 - long gammaChannels = struct.g_channels; - //获取散点图数量信息 - List h_counts = struct.h_counts; + public Map statisticsROIList(Integer startChannel, Integer endChannel, long betaChannels, long gammaChannels, List h_counts) { + Map map = new HashMap<>(); //存储同一列不同行加和后的数量 List sumList = new LinkedList<>(); List seriseDataList = new LinkedList<>(); @@ -286,7 +336,7 @@ public class SelfStationUtil extends AbstractLogOrReport { int sum = 0; //根据起始道值和结束道值 获取这一列的所有对应道值的数据 for (int j=startChannel; j <= endChannel; j++) { - //道值 * 总行数 + 当前列数 获取对应的数据数组下标 + //列数 * 总行数 + 当前行下标 获取对应的数据数组下标 int index = (int) (i * betaChannels + j); long count = 0; //判断下标是否在h_counts范围内 @@ -299,23 +349,10 @@ public class SelfStationUtil extends AbstractLogOrReport { sumList.add(sum); seriseDataList.add(seriseData); } - if (1 == num) { - selfStationData.setROIOneList(seriseDataList); - selfStationData.setROIOneBetaStart(startChannel); - selfStationData.setROIOneBetaStop(endChannel); - } else if (2 == num) { - selfStationData.setROITwoList(seriseDataList); - selfStationData.setROITwoBetaStart(startChannel); - selfStationData.setROITwoBetaStop(endChannel); - } else if (3 == num) { - selfStationData.setROIThreeList(seriseDataList); - selfStationData.setROIThreeBetaStart(startChannel); - selfStationData.setROIThreeBetaStop(endChannel); - } else if (4 == num) { - selfStationData.setROIFourList(seriseDataList); - selfStationData.setROIFourBetaStart(startChannel); - selfStationData.setROIFourBetaStop(endChannel); - } + map.put("startChannel", startChannel); + map.put("endChannel", endChannel); + map.put("dataList", seriseDataList); + return map; } public String UpdateEquationEnergy(ParameterInfo m_curParam) { @@ -412,7 +449,7 @@ public class SelfStationUtil extends AbstractLogOrReport { vChan.add(1.0); vChan.add(Double.valueOf(selfStationData.getSampleStruct().g_channels)); - List vEner = CalValuesHandler.calFcnEval(vChan, selfStationData.getUsedEnerPara().getP()).counts; + List vEner = CalValuesHandler.calFcnEval(vChan, selfStationData.getSampleVueData().getUsedEnerPara().getP()).counts; double d = vEner.get(0), maxE = vEner.get(1); double dStep = maxE / width * 2; @@ -545,7 +582,7 @@ public class SelfStationUtil extends AbstractLogOrReport { vChan.add(1.0); vChan.add(Double.valueOf(selfStationData.getSampleStruct().g_channels)); - List vEner = CalValuesHandler.calFcnEval(vChan, selfStationData.getUsedEnerPara().getP()).counts; + List vEner = CalValuesHandler.calFcnEval(vChan, selfStationData.getSampleVueData().getUsedEnerPara().getP()).counts; double d = vEner.get(0); double maxE = vEner.get(1); double dStep = maxE / width * 2; diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/SelfStationData.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/SelfStationData.java index 03c7922f..b7d21fb6 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/SelfStationData.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/SelfStationData.java @@ -32,105 +32,18 @@ public class SelfStationData implements Serializable { private EnergySpectrumStruct detStruct; /** - * ROI-1结果数据 + * sample对应的操作数据 */ - //折线图横纵坐标数组 - private List ROIOneList; - //ROI-1范围矩形框起始道值 - private Integer ROIOneBetaStart; - //ROI-1范围矩形框终止道值 - private Integer ROIOneBetaStop; + private SelfStationVueData sampleVueData; /** - * ROI-2结果数据 + * det对应的操作数据 */ - //折线图横纵坐标数组 - private List ROITwoList; - //ROI-2范围矩形框起始道值 - private Integer ROITwoBetaStart; - //ROI-2范围矩形框终止道值 - private Integer ROITwoBetaStop; - - /** - * ROI-3结果数据 - */ - //折线图横纵坐标数组 - private List ROIThreeList; - //ROI-3范围矩形框起始道值 - private Integer ROIThreeBetaStart; - //ROI-3范围矩形框终止道值 - private Integer ROIThreeBetaStop; - - /** - * ROI-4结果数据 - */ - //折线图横纵坐标数组 - private List ROIFourList; - //ROI-4范围矩形框起始道值 - private Integer ROIFourBetaStart; - //ROI-4范围矩形框终止道值 - private Integer ROIFourBetaStop; - - // 当前修改的刻度名称 - private String newEner; - - private String newReso; - - private String newEffi; - - /** - * 使用中的能量参数对应的刻度名称 - */ - private String usedEner; - - private String usedReso; - - private String usedEffi; - - // 当前寻峰结果所用的刻度数据 - private GEnergyBlock usedEnerKD; - - private GResolutionBlock usedResoKD; - - private GEfficiencyBlock usedEffiKD; - - // 存储所有的刻度数据 - private Map mapEnerKD; // 能量刻度 - - private Map mapResoKD; // 分辨率刻度 - - private Map mapEffiKD; // 效率刻度 - - // 当前寻峰结果所用的刻度参数 - private ParameterInfo usedEnerPara; - - private ParameterInfo usedResoPara; - - private ParameterInfo usedEffiPara; - - // 存储所有的刻度参数 - private Map mapEnerPara; - - private Map mapResoPara; - - private Map mapEffiPara; + private SelfStationVueData detVueData; public SelfStationData() { - newEner = "PHD"; - newReso = "PHD"; - newEffi = "PHD"; - usedEner= ""; - usedReso= ""; - usedEffi= ""; - mapEnerKD = new HashMap<>(); - mapResoKD = new HashMap<>(); - mapEffiKD = new HashMap<>(); - usedEnerPara = new ParameterInfo(); - usedResoPara = new ParameterInfo(); - usedEffiPara = new ParameterInfo(); - mapEnerPara = new HashMap<>(); - mapResoPara = new HashMap<>(); - mapEffiPara = new HashMap<>(); + sampleVueData = new SelfStationVueData(); + detVueData = new SelfStationVueData(); } } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/SelfStationVueData.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/SelfStationVueData.java new file mode 100644 index 00000000..0a87d485 --- /dev/null +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/entity/vo/SelfStationVueData.java @@ -0,0 +1,115 @@ +package org.jeecg.modules.entity.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Data +public class SelfStationVueData implements Serializable { + + /** + * ROI-1结果数据 + */ + //折线图横纵坐标数组 + private List ROIOneList; + //ROI-1范围矩形框起始道值 + private Integer ROIOneBetaStart; + //ROI-1范围矩形框终止道值 + private Integer ROIOneBetaStop; + + /** + * ROI-2结果数据 + */ + //折线图横纵坐标数组 + private List ROITwoList; + //ROI-2范围矩形框起始道值 + private Integer ROITwoBetaStart; + //ROI-2范围矩形框终止道值 + private Integer ROITwoBetaStop; + + /** + * ROI-3结果数据 + */ + //折线图横纵坐标数组 + private List ROIThreeList; + //ROI-3范围矩形框起始道值 + private Integer ROIThreeBetaStart; + //ROI-3范围矩形框终止道值 + private Integer ROIThreeBetaStop; + + /** + * ROI-4结果数据 + */ + //折线图横纵坐标数组 + private List ROIFourList; + //ROI-4范围矩形框起始道值 + private Integer ROIFourBetaStart; + //ROI-4范围矩形框终止道值 + private Integer ROIFourBetaStop; + + // 当前修改的刻度名称 + private String newEner; + + private String newReso; + + private String newEffi; + + /** + * 使用中的能量参数对应的刻度名称 + */ + private String usedEner; + + private String usedReso; + + private String usedEffi; + + // 当前寻峰结果所用的刻度数据 + private GEnergyBlock usedEnerKD; + + private GResolutionBlock usedResoKD; + + private GEfficiencyBlock usedEffiKD; + + // 存储所有的刻度数据 + private Map mapEnerKD; // 能量刻度 + + private Map mapResoKD; // 分辨率刻度 + + private Map mapEffiKD; // 效率刻度 + + // 当前寻峰结果所用的刻度参数 + private ParameterInfo usedEnerPara; + + private ParameterInfo usedResoPara; + + private ParameterInfo usedEffiPara; + + // 存储所有的刻度参数 + private Map mapEnerPara; + + private Map mapResoPara; + + private Map mapEffiPara; + + public SelfStationVueData() { + newEner = "PHD"; + newReso = "PHD"; + newEffi = "PHD"; + usedEner= ""; + usedReso= ""; + usedEffi= ""; + mapEnerKD = new HashMap<>(); + mapResoKD = new HashMap<>(); + mapEffiKD = new HashMap<>(); + usedEnerPara = new ParameterInfo(); + usedResoPara = new ParameterInfo(); + usedEffiPara = new ParameterInfo(); + mapEnerPara = new HashMap<>(); + mapResoPara = new HashMap<>(); + mapEffiPara = new HashMap<>(); + } + +} 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 6f5fee84..65781704 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 @@ -44,8 +44,7 @@ public class SelfStationServiceImpl implements ISelfStationService { @Override public Result loadSelfStationByFile(String sampleFileName, String detFileName, HttpServletRequest request) { Result result = new Result(); - //返回结果map - Map map = new HashMap<>(); + Map> resultMap = new HashMap<>(); //获取用户名 String userName = JwtUtil.getUserNameByToken(request); //解析文件 @@ -62,28 +61,45 @@ public class SelfStationServiceImpl implements ISelfStationService { if (StringUtils.isNotBlank(sampleFileName)) { //拼接sample文件路径 String sampleFilePath = path + StringPool.SLASH + sampleFileName; - + //返回结果map + Map map = new HashMap<>(); //获取sample分析后的对象 EnergySpectrumStruct struct = selfStationUtil.getSourceData(sampleFilePath, "sample", selfStationData); if (Objects.nonNull(struct)) { selfStationData.setSampleStruct(struct); selfStationData.setSampleTmpPath(sampleFilePath); - selfStationUtil.loadFile(selfStationData, null, null, map); + selfStationUtil.loadFile(selfStationData, null, null, "sample", map); + resultMap.put("sample", map); } } //判断det文件名是否为空 if (StringUtils.isNotBlank(detFileName)) { //拼接det文件路径 String detFilePath = path + StringPool.SLASH + detFileName; + //返回结果map + Map map = new HashMap<>(); //获取sample分析后的对象 EnergySpectrumStruct struct = selfStationUtil.getSourceData(detFilePath, "det", selfStationData); if (Objects.nonNull(struct)) { selfStationData.setDetStruct(struct); selfStationData.setDetTmpPath(detFilePath); + selfStationUtil.loadFile(selfStationData, null, null, "det", map); + resultMap.put("det", map); } } } else { - selfStationUtil.loadFile(selfStationData, null, null, map); + if (StringUtils.isNotBlank(sampleFileName)) { + //返回结果map + Map map = new HashMap<>(); + selfStationUtil.loadFile(selfStationData, null, null, "sample", map); + resultMap.put("sample", map); + } + if (StringUtils.isNotBlank(detFileName)) { + //返回结果map + Map map = new HashMap<>(); + selfStationUtil.loadFile(selfStationData, null, null, "det", map); + resultMap.put("det", map); + } } //将自建台站的数据封装到缓存对象中 selfCache.put(sampleFileName + StringPool.DASH + userName, selfStationData); @@ -91,7 +107,7 @@ public class SelfStationServiceImpl implements ISelfStationService { selfStationCache.setSelfCache(selfCache); //将返回内容存入返回对象中 result.setSuccess(true); - result.setResult(map); + result.setResult(resultMap); return result; } @@ -131,34 +147,28 @@ public class SelfStationServiceImpl implements ISelfStationService { result.error500("Load basic file information first!"); return result; } - selfStationUtil.statisticsROIList(startChannel, endChannel, ROINum,selfStationData); - if (1 == ROINum) { - if ( CollectionUtils.isNotEmpty(selfStationData.getROIOneList()) && Objects.nonNull(selfStationData.getROIOneBetaStart()) - && Objects.nonNull(selfStationData.getROIOneBetaStop()) ) { - map.put("ROIOneList", selfStationData.getROIOneList()); - map.put("ROIOneStart", selfStationData.getROIOneBetaStart()); - map.put("ROIOneStop", selfStationData.getROIOneBetaStop()); - } - } else if (2 == ROINum) { - if ( CollectionUtils.isNotEmpty(selfStationData.getROITwoList()) && Objects.nonNull(selfStationData.getROITwoBetaStart()) - && Objects.nonNull(selfStationData.getROITwoBetaStop()) ) { - map.put("ROITwoList", selfStationData.getROITwoList()); - map.put("ROITwoStart", selfStationData.getROITwoBetaStart()); - map.put("ROITwoStop", selfStationData.getROITwoBetaStop()); - } - } else if (3 == ROINum) { - if ( CollectionUtils.isNotEmpty(selfStationData.getROIThreeList()) && Objects.nonNull(selfStationData.getROIThreeBetaStart()) - && Objects.nonNull(selfStationData.getROIThreeBetaStop()) ) { - map.put("ROIThreeList", selfStationData.getROIThreeList()); - map.put("ROIThreeStart", selfStationData.getROIThreeBetaStart()); - map.put("ROIThreeStop", selfStationData.getROIThreeBetaStop()); - } - } else if (4 == ROINum) { - if ( CollectionUtils.isNotEmpty(selfStationData.getROIFourList()) && Objects.nonNull(selfStationData.getROIFourBetaStart()) - && Objects.nonNull(selfStationData.getROIFourBetaStop()) ) { - map.put("ROIFourList", selfStationData.getROIFourList()); - map.put("ROIFourStart", selfStationData.getROIFourBetaStart()); - map.put("ROIFourStop", selfStationData.getROIFourBetaStop()); + EnergySpectrumStruct struct = selfStationData.getSampleStruct(); + Map resultMap = selfStationUtil.statisticsROIList(startChannel, endChannel, struct.b_channels, struct.g_channels, struct.h_counts); + if ( CollectionUtils.isNotEmpty(resultMap) ) { + Integer startChannelValue = (Integer) resultMap.get("startChannel"); + Integer endChannelValue = (Integer) resultMap.get("endChannel"); + List seriseDataList = (List) resultMap.get("dataList"); + if (1 == ROINum) { + map.put("ROIOneList", seriseDataList); + map.put("ROIOneStart", startChannelValue); + map.put("ROIOneStop", endChannelValue); + } else if (2 == ROINum) { + map.put("ROITwoList", seriseDataList); + map.put("ROITwoStart", startChannelValue); + map.put("ROITwoStop", endChannelValue); + } else if (3 == ROINum) { + map.put("ROIThreeList", seriseDataList); + map.put("ROIThreeStart", startChannelValue); + map.put("ROIThreeStop", endChannelValue); + } else if (4 == ROINum) { + map.put("ROIFourList", seriseDataList); + map.put("ROIFourStart", startChannelValue); + map.put("ROIFourStop", endChannelValue); } } result.setSuccess(true); @@ -180,17 +190,17 @@ public class SelfStationServiceImpl implements ISelfStationService { return result; } if (StringUtils.isBlank(currentText)) { - currentText = selfStationData.getUsedEner(); + currentText = selfStationData.getSampleVueData().getUsedEner(); } - List dataSourceList = selfStationData.getMapEnerKD().keySet().stream().collect(Collectors.toList()); + List dataSourceList = selfStationData.getSampleVueData().getMapEnerKD().keySet().stream().collect(Collectors.toList()); map.put("list_dataSource", dataSourceList); if (StringUtils.isNotBlank(currentText)) { map.put("currentText", currentText); - List m_vCurCentroid = selfStationData.getMapEnerKD().get(currentText).getCentroid_channel(); - List m_vCurEnergy = selfStationData.getMapEnerKD().get(currentText).getG_energy(); - List m_vCurUncert = selfStationData.getMapEnerKD().get(currentText).getUncertainty(); + List m_vCurCentroid = selfStationData.getSampleVueData().getMapEnerKD().get(currentText).getCentroid_channel(); + List m_vCurEnergy = selfStationData.getSampleVueData().getMapEnerKD().get(currentText).getG_energy(); + List m_vCurUncert = selfStationData.getSampleVueData().getMapEnerKD().get(currentText).getUncertainty(); map.put("uncert", m_vCurUncert); - ParameterInfo m_curParam = selfStationData.getMapEnerPara().get(currentText); + ParameterInfo m_curParam = selfStationData.getSampleVueData().getMapEnerPara().get(currentText); if (Objects.isNull(m_curParam)) { m_curParam = new ParameterInfo(); } @@ -297,7 +307,7 @@ public class SelfStationServiceImpl implements ISelfStationService { return result; } if (!curCalName.contains("Input")) { - List list_cal = selfStationData.getMapEnerKD().keySet().stream().collect(Collectors.toList()); + List list_cal = selfStationData.getSampleVueData().getMapEnerKD().keySet().stream().collect(Collectors.toList()); curCalName = "Input " + (list_cal.stream().filter(item -> item.contains("Input")).collect(Collectors.toList()).size() + 1); list_cal.add(curCalName); result.setSuccess(true); @@ -308,8 +318,8 @@ public class SelfStationServiceImpl implements ISelfStationService { gEnergyBlock.setG_energy(m_vCurEnergy); gEnergyBlock.setUncertainty(m_vCurUncert); gEnergyBlock.setRecord_count(m_vCurCentroid.size()); - selfStationData.getMapEnerKD().put(curCalName, gEnergyBlock); - selfStationData.getMapEnerPara().put(curCalName, m_curParam); + selfStationData.getSampleVueData().getMapEnerKD().put(curCalName, gEnergyBlock); + selfStationData.getSampleVueData().getMapEnerPara().put(curCalName, m_curParam); return result; } @@ -393,7 +403,7 @@ public class SelfStationServiceImpl implements ISelfStationService { map.put("uncert", m_vCurUncert); ParameterInfo m_curParam = new ParameterInfo(); if (StringUtils.isNotBlank(currentText)) { - m_curParam = selfStationData.getMapEnerPara().get(currentText); + m_curParam = selfStationData.getSampleVueData().getMapEnerPara().get(currentText); } map.put("param", m_curParam); int num = m_vCurEnergy.size(); @@ -449,7 +459,7 @@ public class SelfStationServiceImpl implements ISelfStationService { return result; } if (StringUtils.isNotBlank(currentName)) { - selfStationData.setNewEner(currentName); + selfStationData.getSampleVueData().setNewEner(currentName); } selfCache.put(fileName, selfStationData); selfStationCache.setSelfCache(selfCache); @@ -471,17 +481,17 @@ public class SelfStationServiceImpl implements ISelfStationService { return result; } if (StringUtils.isBlank(currentText)) { - currentText = selfStationData.getUsedReso(); + currentText = selfStationData.getSampleVueData().getUsedReso(); } - List dataSourceList = selfStationData.getMapResoKD().keySet().stream().collect(Collectors.toList()); + List dataSourceList = selfStationData.getSampleVueData().getMapResoKD().keySet().stream().collect(Collectors.toList()); map.put("list_dataSource", dataSourceList); if (StringUtils.isNotBlank(currentText)) { map.put("currentText", currentText); - List m_vCurReso = selfStationData.getMapResoKD().get(currentText).getFWHM(); - List m_vCurEnergy = selfStationData.getMapResoKD().get(currentText).getG_energy(); - List m_vCurUncert = selfStationData.getMapResoKD().get(currentText).getUncertainty(); + List m_vCurReso = selfStationData.getSampleVueData().getMapResoKD().get(currentText).getFWHM(); + List m_vCurEnergy = selfStationData.getSampleVueData().getMapResoKD().get(currentText).getG_energy(); + List m_vCurUncert = selfStationData.getSampleVueData().getMapResoKD().get(currentText).getUncertainty(); map.put("uncert", m_vCurUncert); - ParameterInfo m_curParam = selfStationData.getMapResoPara().get(currentText); + ParameterInfo m_curParam = selfStationData.getSampleVueData().getMapResoPara().get(currentText); if (Objects.isNull(m_curParam)) { m_curParam = new ParameterInfo(); } @@ -577,7 +587,7 @@ public class SelfStationServiceImpl implements ISelfStationService { return result; } if (!curCalName.contains("Input")) { - List list_cal = selfStationData.getMapResoKD().keySet().stream().collect(Collectors.toList()); + List list_cal = selfStationData.getSampleVueData().getMapResoKD().keySet().stream().collect(Collectors.toList()); curCalName = "Input " + (list_cal.stream().filter(item -> item.contains("Input")).collect(Collectors.toList()).size() + 1); list_cal.add(curCalName); result.setSuccess(true); @@ -588,8 +598,8 @@ public class SelfStationServiceImpl implements ISelfStationService { gResolutionBlock.setG_energy(m_vCurEnergy); gResolutionBlock.setUncertainty(m_vCurUncert); gResolutionBlock.setRecord_count(m_vCurEnergy.size()); - selfStationData.getMapResoKD().put(curCalName, gResolutionBlock); - selfStationData.getMapResoPara().put(curCalName, m_curParam); + selfStationData.getSampleVueData().getMapResoKD().put(curCalName, gResolutionBlock); + selfStationData.getSampleVueData().getMapResoPara().put(curCalName, m_curParam); return result; } @@ -673,7 +683,7 @@ public class SelfStationServiceImpl implements ISelfStationService { map.put("uncert", m_vCurUncert); ParameterInfo m_curParam = new ParameterInfo(); if (StringUtils.isNotBlank(currentText)) { - m_curParam = selfStationData.getMapResoPara().get(currentText); + m_curParam = selfStationData.getSampleVueData().getMapResoPara().get(currentText); } map.put("param", m_curParam); int num = m_vCurEnergy.size(); @@ -729,7 +739,7 @@ public class SelfStationServiceImpl implements ISelfStationService { return result; } if (StringUtils.isNotBlank(currentName)) { - selfStationData.setNewReso(currentName); + selfStationData.getSampleVueData().setNewReso(currentName); } selfCache.put(fileName, selfStationData); selfStationCache.setSelfCache(selfCache); @@ -759,17 +769,17 @@ public class SelfStationServiceImpl implements ISelfStationService { return result; } if (StringUtils.isBlank(currentText)) { - currentText = selfStationData.getUsedEffi(); + currentText = selfStationData.getSampleVueData().getUsedEffi(); } - List dataSourceList = selfStationData.getMapEffiKD().keySet().stream().collect(Collectors.toList()); + List dataSourceList = selfStationData.getSampleVueData().getMapEffiKD().keySet().stream().collect(Collectors.toList()); map.put("list_dataSource", dataSourceList); if (StringUtils.isNotBlank(currentText)) { map.put("currentText", currentText); - List m_vCurEffi = selfStationData.getMapEffiKD().get(currentText).getEfficiency(); - List m_vCurEnergy = selfStationData.getMapEffiKD().get(currentText).getG_energy(); - List m_vCurUncert = selfStationData.getMapEffiKD().get(currentText).getUncertainty(); + List m_vCurEffi = selfStationData.getSampleVueData().getMapEffiKD().get(currentText).getEfficiency(); + List m_vCurEnergy = selfStationData.getSampleVueData().getMapEffiKD().get(currentText).getG_energy(); + List m_vCurUncert = selfStationData.getSampleVueData().getMapEffiKD().get(currentText).getUncertainty(); map.put("uncert", m_vCurUncert); - ParameterInfo m_curParam = selfStationData.getMapEffiPara().get(currentText); + ParameterInfo m_curParam = selfStationData.getSampleVueData().getMapEffiPara().get(currentText); if (Objects.isNull(m_curParam)) { m_curParam = new ParameterInfo(); } @@ -865,7 +875,7 @@ public class SelfStationServiceImpl implements ISelfStationService { return result; } if (!curCalName.contains("Input")) { - List list_cal = selfStationData.getMapEffiKD().keySet().stream().collect(Collectors.toList()); + List list_cal = selfStationData.getSampleVueData().getMapEffiKD().keySet().stream().collect(Collectors.toList()); curCalName = "Input " + (list_cal.stream().filter(item -> item.contains("Input")).collect(Collectors.toList()).size() + 1); list_cal.add(curCalName); result.setSuccess(true); @@ -876,8 +886,8 @@ public class SelfStationServiceImpl implements ISelfStationService { gEfficiencyBlock.setG_energy(m_vCurEnergy); gEfficiencyBlock.setUncertainty(m_vCurUncert); gEfficiencyBlock.setRecord_count(m_vCurEnergy.size()); - selfStationData.getMapEffiKD().put(curCalName, gEfficiencyBlock); - selfStationData.getMapEffiPara().put(curCalName, m_curParam); + selfStationData.getSampleVueData().getMapEffiKD().put(curCalName, gEfficiencyBlock); + selfStationData.getSampleVueData().getMapEffiPara().put(curCalName, m_curParam); return result; } @@ -969,7 +979,7 @@ public class SelfStationServiceImpl implements ISelfStationService { map.put("uncert", m_vCurUncert); ParameterInfo m_curParam = new ParameterInfo(); if (StringUtils.isNotBlank(currentText)) { - m_curParam = selfStationData.getMapEffiPara().get(currentText); + m_curParam = selfStationData.getSampleVueData().getMapEffiPara().get(currentText); } if (m_curParam.getP().size() > 0) { m_curParam.getP().set(0, m_nFunId); @@ -1029,7 +1039,7 @@ public class SelfStationServiceImpl implements ISelfStationService { return result; } if (StringUtils.isNotBlank(currentName)) { - selfStationData.setNewEffi(currentName); + selfStationData.getSampleVueData().setNewEffi(currentName); } selfCache.put(fileName, selfStationData); selfStationCache.setSelfCache(selfCache); diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java index f116b60c..3c86ae61 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/SpectrumAnalysisServiceImpl.java @@ -4057,14 +4057,12 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements String logFilePath = parameterProperties.getLogFilePath() + File.separator + DateUtils.formatDate(new Date(), "yyyy-MM-dd") + File.separator + betaDataFile.getSampleFileName().replace("PHD", "log"); File logFile = new File(logFilePath); try { - FileInputStream in = new FileInputStream(logFile); - ftpUtil.saveFile(logPathName, logFileName, in); + if (logFile.exists()) { + FileInputStream in = new FileInputStream(logFile); + ftpUtil.saveFile(logPathName, logFileName, in); + } } catch (FileNotFoundException e) { throw new RuntimeException(e); - } finally { - if (Objects.nonNull(logFile)) { - logFile.delete(); - } } } { diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/controller/WebStatisticsController.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/controller/WebStatisticsController.java index 45d583f7..04f1ab3b 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/controller/WebStatisticsController.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/controller/WebStatisticsController.java @@ -198,4 +198,22 @@ public class WebStatisticsController { HttpServletResponse response){ reviewedService.rrrExport(stationIds, startTime, endTime,response); } + + @GetMapping("findNuclideList") + @ApiOperation(value = "查询核素列表数据", notes = "查询核素列表数据") + public Result findNuclideList(String systemType) { + return gardsSampleDataWebService.findNuclideList(systemType); + } + + @GetMapping("findNuclideStatistics") + @ApiOperation(value = "查询核素统计结果", notes = "查询核素统计结果") + public Result findNuclideStatistics(String stationId, String systemType, String dbName, String[] nuclideNames, + @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate) { + return gardsSampleDataWebService.findNuclideStatistics(stationId, systemType, dbName, nuclideNames, startDate, endDate); + } + + + + + } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDataWebMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDataWebMapper.java index 22f8ccdb..06cbc680 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDataWebMapper.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/GardsSampleDataWebMapper.java @@ -8,6 +8,7 @@ import org.jeecg.modules.entity.GardsSampleDataWeb; import org.jeecg.modules.entity.vo.SpectrumFileRecord; import java.util.List; +import java.util.Map; @Mapper public interface GardsSampleDataWebMapper extends BaseMapper { @@ -26,4 +27,6 @@ public interface GardsSampleDataWebMapper extends BaseMapper Integer getSampleId(@Param(value = "filePathName") String filePathName); + List> findNuclideStatistics(@Param(value = "stationId") String stationId, @Param(value = "startTime") String startTime, @Param(value = "endTime") String endTime, @Param(value = "nuclideSql") String nuclideSql); + } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysDefaultNuclideMapper.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysDefaultNuclideMapper.java new file mode 100644 index 00000000..5f2ce650 --- /dev/null +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/SysDefaultNuclideMapper.java @@ -0,0 +1,9 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide; + +@Mapper +public interface SysDefaultNuclideMapper extends BaseMapper { +} diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/GardsSampleDataWebMapper.xml b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/GardsSampleDataWebMapper.xml index 99520a71..f13f9d8a 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/GardsSampleDataWebMapper.xml +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/mapper/xml/GardsSampleDataWebMapper.xml @@ -174,4 +174,48 @@ SELECT SAMPLE_ID FROM ORIGINAL.GARDS_SAMPLE_DATA WHERE INPUT_FILE_NAME = #{filePathName} + + \ No newline at end of file diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java index 52ca749c..e5c19c72 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/IGardsSampleDataWebService.java @@ -51,4 +51,9 @@ public interface IGardsSampleDataWebService extends IService List sampleIds); List queryByModDate(Date startTime, Date endTime); + + Result findNuclideList(String systemType); + + Result findNuclideStatistics(String stationId, String systemType, String dbName, String[] nuclideNames, Date startDate, Date endDate); + } diff --git a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java index 30a22aa7..7fec78b1 100644 --- a/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java +++ b/jeecg-module-web-statistics/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataWebServiceImpl.java @@ -23,6 +23,8 @@ import org.jeecg.common.util.*; import org.jeecg.modules.base.entity.original.GardsSampleAux; import org.jeecg.modules.base.entity.original.GardsSampleData; import org.jeecg.modules.base.entity.original.GardsSampleDescription; +import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide; +import org.jeecg.modules.base.enums.SystemType; import org.jeecg.modules.entity.GardsSampleDataWeb; import org.jeecg.modules.entity.data.*; import org.jeecg.modules.entity.vo.SpectrumFileRecord; @@ -52,26 +54,10 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(SysDefaultNuclide::getUseType, 4); + if (systemType.equals("beta")) { + queryWrapper.eq(SysDefaultNuclide::getNuclideType, SystemType.BETA.getType()); + } else if (systemType.equals("gamma")) { + queryWrapper.eq(SysDefaultNuclide::getNuclideType, SystemType.GAMMA.getType()); + } else if (systemType.equals("Particulate")) { + queryWrapper.eq(SysDefaultNuclide::getNuclideType, SystemType.PARTICULATE.getType()); + } + List defaultNuclides = defaultNuclideMapper.selectList(queryWrapper); + result.setSuccess(true); + result.setResult(defaultNuclides); + return result; + } + + @Override + public Result findNuclideStatistics(String stationId, String systemType, String dbName, String[] nuclideNames, Date startDate, Date endDate) { + Result result = new Result(); + Map resultMap = new HashMap<>(); + //判断开始时间是否为空 + if (Objects.isNull(startDate)){ + result.error500("The start time cannot be empty"); + return result; + } + String startTime = DateUtils.formatDate(startDate, "yyyy-MM-dd") + " 00:00:00"; + //判断结束时间是否为空 + if (Objects.isNull(endDate)) { + result.error500("The end time cannot be empty"); + return result; + } + String endTime = DateUtils.formatDate(endDate, "yyyy-MM-dd") + " 23:59:59"; + //判断查询的核素内容是否为空 + List nuclideNameList = new LinkedList<>(); + if (nuclideNames != null && nuclideNames.length > 0) { + nuclideNameList = Arrays.asList(nuclideNames); + } + //判断要查询的数据库类型 + if (dbName.equals("auto")) { + dbName = "RNAUTO"; + } else if (dbName.equals("man")) { + dbName = "RNMAN"; + } + //判断系统类型查询对应匹配的核素信息 + String nuclideSql = ""; + if (systemType.equals("beta")) { + nuclideSql = betaNuclideSql(dbName, nuclideNameList); + for (int i=0; i< nuclideNameList.size(); i++) { + String nuclideName = nuclideNameList.get(i); + if (StringUtils.isNotBlank(nuclideName)) { + List concList = new LinkedList<>(); + List mdcList = new LinkedList<>(); + resultMap.put(nuclideName+"Conc", concList); + resultMap.put(nuclideName+"MDC", mdcList); + } + } + } else if (systemType.equals("gamma")) { + nuclideSql = gammaNuclideSql(dbName, nuclideNameList); + for (int i=0; i< nuclideNameList.size(); i++) { + String nuclideName = nuclideNameList.get(i); + if (StringUtils.isNotBlank(nuclideName)) { + List concList = new LinkedList<>(); + List mdcList = new LinkedList<>(); + resultMap.put(nuclideName+"Conc", concList); + resultMap.put(nuclideName+"MDC", mdcList); + } + } + } else if (systemType.equals("Particulate")) { + nuclideSql = particulateSql(dbName, nuclideNameList); + for (int i=0; i< nuclideNameList.size(); i++) { + String nuclideName = nuclideNameList.get(i); + if (StringUtils.isNotBlank(nuclideName)) { + List concList = new LinkedList<>(); + resultMap.put(nuclideName+"Conc", concList); + } + } + } + //拼接sql查询结果 + List> nuclideStatisticsMap = this.baseMapper.findNuclideStatistics(stationId, startTime, endTime, nuclideSql); + //处理查询结果 + handleNuclideData(nuclideStatisticsMap, systemType, nuclideNameList, resultMap); + result.setSuccess(true); + result.setResult(resultMap); + return result; + } + + private String betaNuclideSql(String dbName, List nuclideNames) { + String sql = ""; + //存储每个核素对应的sql + List nuclideSqls = new LinkedList<>(); + //遍历核素名称拼接sql语句 + for (int i=0; i nuclideNames) { + String sql = ""; + //存储每个核素对应的sql + List nuclideSqls = new LinkedList<>(); + //遍历核素名称 + for (int i=0; i nuclideNames) { + String sql = ""; + //存储核素sql + List nuclideSqls = new LinkedList<>(); + //遍历核素信息 + for (int i=0; i> nuclideStatisticsMap, String systemType, List nuclideNameList, Map resultMap) { + //存储横坐标采集开始时间 + List collectStartList = new LinkedList<>(); + //存储横坐标对应体积 + List quantityList = new LinkedList<>(); + //存储横坐标对应acq活时间 + List acqLiveSecList = new LinkedList<>(); + //遍历查询结果数组 + for (Map nuclideStatistics: nuclideStatisticsMap) { + //获取采集开始时间 + Object collectStart = nuclideStatistics.get("COLLECT_START"); + //如果采集开始时间不为空 则存储 + if (Objects.nonNull(collectStart)) { + collectStartList.add(collectStart.toString()); + } else {//否则跳过本次循环 + continue; + } + //获取体积 + Object quantity = nuclideStatistics.get("QUANTITY"); + //判断体积数值是否有 如果有 正常存储 + if (Objects.nonNull(quantity)) { + quantityList.add(Double.valueOf(quantity.toString())); + } else {//如果没有存储0 + quantityList.add(0.0); + } + //获取acq活时间 + Object acquisitionLiveSec = nuclideStatistics.get("ACQUISITION_LIVE_SEC"); + //判断活时间是否为空 如果不为空 正常存储 + if (Objects.nonNull(acquisitionLiveSec)) { + acqLiveSecList.add(Double.valueOf(acquisitionLiveSec.toString())); + } else {//如果为空存储0 + acqLiveSecList.add(0.0); + } + //判断系统类型决定读取核素的信息 + if (systemType.equals("beta") || systemType.equals("gamma")) { + for (String nuclideName: nuclideNameList) { + List concList = (List) resultMap.get(nuclideName + "Conc"); + List mdcList = (List) resultMap.get(nuclideName + "MDC"); + //将核素名称转为全部大写 + String columnName = StringUtils.upperCase(nuclideName); + //读取查询出的浓度 + Object conc = nuclideStatistics.get(columnName); + //判断如果浓度不为空 正常存储 + if (Objects.nonNull(conc)) { + concList.add(Double.valueOf(conc.toString())); + } else {//如果为空 存储0 + concList.add(0.0); + } + //读取查询出的mdc结果 + Object mdc = nuclideStatistics.get(columnName + "MDC"); + //判断如果mdc结果不为空 正常存储 + if (Objects.nonNull(mdc)) { + mdcList.add(Double.valueOf(mdc.toString())); + } else { + mdcList.add(0.0); + } + } + } else if (systemType.equals("Particulate")) { + for (String nuclideName: nuclideNameList) { + List concList = (List) resultMap.get(nuclideName + "Conc"); + //将核素名称转为全部大写 + String columnName = StringUtils.upperCase(nuclideName); + //读取查询出的浓度 + Object conc = nuclideStatistics.get(columnName); + //判断如果浓度不为空 正常存储 + if (Objects.nonNull(conc)) { + concList.add(Double.valueOf(conc.toString())); + } else {//如果为空 存储0 + concList.add(0.0); + } + } + } + } + resultMap.put("CollectStart", collectStartList); + resultMap.put("Quantity", quantityList); + resultMap.put("AcqLiveSec", acqLiveSecList); + } + }