From 01ea4f8c637afc00006e3f0e39157d6364009b71 Mon Sep 17 00:00:00 2001 From: nieziyan Date: Fri, 26 Jul 2024 19:15:46 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E8=87=AA=E5=BB=BA=E5=8F=B0?= =?UTF-8?q?=E7=AB=99=E4=BA=A4=E4=BA=92=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/rnman/GardsAnalySettingRoi.java | 78 ++ .../base/entity/rnman/GardsAnalysisRoi.java | 41 ++ .../rnman/GardsCalibrationPairsRoi.java | 74 ++ .../entity/rnman/GardsCalibrationRoi.java | 119 ++++ .../base/entity/rnman/GardsMDCRoi.java | 48 ++ .../base/entity/rnman/GardsNuclIdedRoi.java | 122 ++++ .../entity/rnman/GardsNuclLinesIdedRoi.java | 126 ++++ .../base/entity/rnman/GardsPeaksRoi.java | 166 +++++ .../base/entity/rnman/GardsQcCheckRoi.java | 42 ++ .../modules/spectrum/Sample_C_Analysis.java | 39 +- .../org/jeecg/common/util/GammaFileUtil.java | 15 + .../mapper/GardsAnalySettingRoiMapper.java | 9 + .../mapper/GardsAnalysisRoiManMapper.java | 8 + .../GardsCalibrationPairsRoiManMapper.java | 8 + .../mapper/GardsCalibrationRoiManMapper.java | 14 + .../modules/mapper/GardsMdcRoiManMapper.java | 8 + .../mapper/GardsNuclIdedRoiManMapper.java | 8 + .../GardsNuclLinesIdedRoiManMapper.java | 8 + .../mapper/GardsPeaksRoiManMapper.java | 8 + .../mapper/GardsQcCheckRoiManMapper.java | 8 + .../xml/GardsCalibrationRoiManMapper.xml | 35 + .../modules/service/AnalysisManService.java | 50 ++ .../service/IGardsAnalySettingRoiService.java | 10 + .../service/IGardsAnalysisRoiManService.java | 13 + .../IGardsCalibrationPairsRoiManService.java | 8 + .../IGardsCalibrationRoiManService.java | 11 + .../service/IGardsMdcRoiManService.java | 8 + .../service/IGardsNuclIdedRoiManService.java | 8 + .../IGardsNuclLinesIdedRoiManService.java | 8 + .../service/IGardsPeaksRoiManService.java | 8 + .../service/IGardsQcCheckRoiManService.java | 8 + .../service/impl/AnalysisManServiceImpl.java | 665 ++++++++++++++++++ .../impl/GardsAnalySettingRoiServiceImpl.java | 17 + .../impl/GardsAnalysisRoiManServiceImpl.java | 34 + ...rdsCalibrationPairsRoiAutoServiceImpl.java | 8 +- ...ardsCalibrationPairsRoiManServiceImpl.java | 15 + .../GardsCalibrationRoiManServiceImpl.java | 20 + .../impl/GardsMdcRoiAutoServiceImpl.java | 2 + .../impl/GardsMdcRoiManServiceImpl.java | 14 + .../impl/GardsNuclIdedRoiAutoServiceImpl.java | 8 +- .../impl/GardsNuclIdedRoiManServiceImpl.java | 15 + .../GardsNuclLinesIdedRoiAutoServiceImpl.java | 8 +- .../GardsNuclLinesIdedRoiManServiceImpl.java | 15 + .../impl/GardsPeaksRoiAutoServiceImpl.java | 9 +- .../impl/GardsPeaksRoiManServiceImpl.java | 13 + .../impl/GardsQcCheckRoiAutoServiceImpl.java | 8 +- .../impl/GardsQcCheckRoiManServiceImpl.java | 14 + .../controller/SelfStationController.java | 6 + .../IGardsAnalysesSpectrumService.java | 2 + .../modules/service/ISelfStationService.java | 2 + .../GardsAnalysesSpectrumServiceImpl.java | 18 + .../service/impl/SelfStationServiceImpl.java | 357 +++++++++- .../impl/SpectrumAnalysisServiceImpl.java | 2 +- .../resources/jeecg/jeecg_config.properties | 2 +- .../resources/jeecg/jeecg_database.properties | 6 +- 55 files changed, 2321 insertions(+), 55 deletions(-) create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsAnalySettingRoi.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsAnalysisRoi.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsCalibrationPairsRoi.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsCalibrationRoi.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsMDCRoi.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsNuclIdedRoi.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsNuclLinesIdedRoi.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsPeaksRoi.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsQcCheckRoi.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsAnalySettingRoiMapper.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsAnalysisRoiManMapper.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsCalibrationPairsRoiManMapper.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsCalibrationRoiManMapper.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsMdcRoiManMapper.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsNuclIdedRoiManMapper.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsNuclLinesIdedRoiManMapper.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsPeaksRoiManMapper.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsQcCheckRoiManMapper.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/xml/GardsCalibrationRoiManMapper.xml create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/AnalysisManService.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsAnalySettingRoiService.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsAnalysisRoiManService.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsCalibrationPairsRoiManService.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsCalibrationRoiManService.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsMdcRoiManService.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsNuclIdedRoiManService.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsNuclLinesIdedRoiManService.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsPeaksRoiManService.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsQcCheckRoiManService.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/AnalysisManServiceImpl.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsAnalySettingRoiServiceImpl.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsAnalysisRoiManServiceImpl.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsRoiManServiceImpl.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationRoiManServiceImpl.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsMdcRoiManServiceImpl.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedRoiManServiceImpl.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclLinesIdedRoiManServiceImpl.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsPeaksRoiManServiceImpl.java create mode 100644 jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsQcCheckRoiManServiceImpl.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsAnalySettingRoi.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsAnalySettingRoi.java new file mode 100644 index 00000000..4fdec11b --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsAnalySettingRoi.java @@ -0,0 +1,78 @@ +package org.jeecg.modules.base.entity.rnman; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName(value = "RNMAN.GARDS_ANALY_SETTING_ROI") +public class GardsAnalySettingRoi implements Serializable { + + @TableField(value = "IDANALYSIS") + private Integer idanalysis; + + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + + private Integer roiId; + + @TableField(value = "MODDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date moddate; + + @TableField(value = "ECUTANALYSIS_LOW") + private Double ecutanalysisLow; + + @TableField(value = "ECUTANALYSIS_HIGH") + private Double ecutanalysisHigh; + + @TableField(value = "ENERGYTOLERANCE") + private Double energytolerance; + + @TableField(value = "CALIBRATIONPSS_HIGH") + private Double calibrationpssHigh; + + @TableField(value = "CALIBRATIONPSS_LOW") + private Double calibrationpssLow; + + @TableField(value = "BASEIMPROVEPSS") + private Double baseimprovepss; + + @TableField(value = "PSS_LOW") + private Double pssLow; + + @TableField(value = "K_BACK") + private Double KBack; + + @TableField(value = "K_ALPHA") + private Double KAlpha; + + @TableField(value = "K_BETA") + private Double KBeta; + + @TableField(value = "RISKLEVELK") + private Double risklevelk; + + @TableField(value = "BUPDATECAL") + private Integer bupdatecal; + + @TableField(value = "KEEPCALPEAKSERCHPEAKS") + private Integer keepcalpeakserchpeaks; + + @TableField(value = "REFTIME_ACT") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date reftimeAct; + + @TableField(value = "REFTIME_CONC") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date reftimeConc; + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsAnalysisRoi.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsAnalysisRoi.java new file mode 100644 index 00000000..df27599b --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsAnalysisRoi.java @@ -0,0 +1,41 @@ +package org.jeecg.modules.base.entity.rnman; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@TableName("RNMAN.GARDS_ANALYSIS_ROI") +@Accessors(chain = true) +public class GardsAnalysisRoi { + + @TableId("IDANALYSIS") + private Integer idAnalysis; + + private Integer sampleId; + + private Integer roiId; + + private Integer roiNum; + + private Double minX; + + private Double maxX; + + private Double minY; + + private Double maxY; + + private String phdPath; + + private String baselinePath; + + private String lcPath; + + private String scacPath; + + private String logPath; + + private String reportPath; +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsCalibrationPairsRoi.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsCalibrationPairsRoi.java new file mode 100644 index 00000000..d6a55481 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsCalibrationPairsRoi.java @@ -0,0 +1,74 @@ +package org.jeecg.modules.base.entity.rnman; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * 存储数据分析过程中能量、分辨率和效率刻度实际使用的刻度点数据。 + */ +@Data +@TableName("RNMAN.GARDS_CALIBRATION_PAIRS_ROI") +public class GardsCalibrationPairsRoi implements Serializable { + + /** + * 样品id + */ + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + /** + * 分析ID号 + */ + @TableField(value = "IDANALYSIS") + private Integer idAnalysis; + + private Integer roiId; + + /** + * G:gamma探测器的数据,#g_;B:beta探测器的数据,#b_ + */ + @TableField(value = "SAMPLE_TYPE") + private String sampleType; + /** + * energy:能量刻度; + * efficiency:效率刻度; + * Resolution:分辨率刻度 + */ + @TableField(value = "CALTYPE") + private String caltype; + /** + * PHD:代表数据来自PHD文件;External:代表数据来自外部,如刻度工具、其它文件等 + */ + @TableField(value = "INPUT") + private String input; + /** + * 刻度点ID号 + */ + @TableField(value = "IDCALPOINT") + private Integer idCalPoint; + + @TableField(value = "XVALUE") + private Double xValue; + + @TableField(value = "YVALUE") + private Double yValue; + + @TableField(value = "DECAY_MODE") + private String decayMode; + /** + * y值不确定度 + */ + @TableField(value = "UNCYVALUE") + private Double uncYValue; + + @TableField(value = "MODDATE") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date moddate; + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsCalibrationRoi.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsCalibrationRoi.java new file mode 100644 index 00000000..3814030c --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsCalibrationRoi.java @@ -0,0 +1,119 @@ +package org.jeecg.modules.base.entity.rnman; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * 存储数据分析过程中能量、分辨率和效率刻度的拟合结果。 + */ +@Data +@TableName("RNMAN.GARDS_CALIBRATION_ROI") +public class GardsCalibrationRoi implements Serializable { + + /** + * 样品id + */ + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + /** + * 分析ID号 + */ + @TableField(value = "IDANALYSIS") + private Integer idAnalysis; + + @TableField(value = "ROI_ID") + private Integer roiId; + + /** + * G:gamma探测器的数据,#g_;B:beta探测器的数据,#b_ + */ + @TableField(value = "SAMPLE_TYPE") + private String sampleType; + /** + * energy:能量刻度; + * efficiency:效率刻度; + * Resolution:分辨率刻度 + */ + @TableField(value = "CALTYPE") + private String calType; + /** + * 拟合方程ID号(统一定义) + */ + @TableField(value = "FUNCTION") + private Integer function; + /** + * 拟合方程描述 + */ + @TableField(value = "FUNCTIONDEF") + private String functionDef; + /** + * 拟合的起始值 + */ + @TableField(value = "STARTOFRANGE") + private Integer startOfRange; + /** + * 拟合的结束值 + */ + @TableField(value = "ENDOFRANGE") + private Integer endOfRange; + /** + * 拟合系数1 + */ + @TableField(value = "COEFF1") + private Double coeff1; + /** + * 拟合系数2 + */ + @TableField(value = "COEFF2") + private Double coeff2; + /** + * 拟合系数3 + */ + @TableField(value = "COEFF3") + private Double coeff3; + /** + * 拟合系数4 + */ + @TableField(value = "COEFF4") + private Double coeff4; + /** + * 拟合系数5 + */ + @TableField(value = "COEFF5") + private Double coeff5; + /** + * 拟合系数6 + */ + @TableField(value = "COEFF6") + private Double coeff6; + /** + * 拟合系数7 + */ + @TableField(value = "COEFF7") + private Double coeff7; + /** + * 拟合系数8 + */ + @TableField(value = "COEFF8") + private Double coeff8; + /** + * 拟合系数9 + */ + @TableField(value = "COEFF9") + private Double coeff9; + + @TableField(value = "MODDATE") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date moddate; + + @TableField(value = "COEFF_STRING") + private String coeffString; + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsMDCRoi.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsMDCRoi.java new file mode 100644 index 00000000..8a5877c0 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsMDCRoi.java @@ -0,0 +1,48 @@ +package org.jeecg.modules.base.entity.rnman; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName("RNMAN.GARDS_MDC_ROI") +public class GardsMDCRoi implements Serializable { + + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + + @TableField(value = "IDANALYSIS") + private Integer idAnalysis; + + @TableField(value = "ROI_ID") + private Integer roiId; + + @TableField(value = "NUCLIDENAME") + private String nuclideName; + + @TableField(value = "ENERGY") + private Double energy; + + @TableField(value = "YIELD") + private Double yield; + + @TableField(value = "EFFICIENCY") + private Double efficiency; + + @TableField(value = "MDC") + private String mdc; + + @TableField(value = "MDC_ERR") + private String mdcErr; + + @TableField(value = "MODDATE") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date moddate; + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsNuclIdedRoi.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsNuclIdedRoi.java new file mode 100644 index 00000000..3f40a4c1 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsNuclIdedRoi.java @@ -0,0 +1,122 @@ +package org.jeecg.modules.base.entity.rnman; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * 存储gamma谱中识别到的核素计算结果。 + */ +@Data +@TableName("RNMAN.GARDS_NUCL_IDED_ROI") +public class GardsNuclIdedRoi implements Serializable { + + /** + * 样品id + */ + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + /** + * 分析ID号 + */ + @TableField(value = "IDANALYSIS") + private Integer idAnalysis; + + @TableField(value = "ROI_ID") + private Integer roiId; + + /** + * 核素名称 + */ + @TableField(value = "NUCLIDENAME") + private String nuclideName; + /** + * 核素类型 + */ + @TableField(value = "TYPE") + private String type; + /** + * 核素半衰期 + */ + @TableField(value = "HALFLIFE") + private String halflife; + /** + * 平均活度值 + */ + @TableField(value = "AVE_ACTIV") + private String aveActiv; + /** + * 平均活度值不确定度 + */ + @TableField(value = "AVE_ACTIV_ERR") + private Double aveActivErr; + /** + * 主射线活度值 + */ + @TableField(value = "ACTIV_KEY") + private Double activKey; + /** + * 主射线活度值不确定度 + */ + @TableField(value = "ACTIV_KEY_ERR") + private Double activKeyErr; + /** + * 核素的最小可探测活度 + */ + @TableField(value = "MDA") + private String mda; + /** + * 核素的最小可探测活度不确定度 + */ + @TableField(value = "MDA_ERR") + private Double mdaErr; + /** + * 核素识别标志 + */ + @TableField(value = "NID_FLAG") + private Integer nidFlag; + + @TableField(value = "ACTIV_DECAY") + private Double activDecay; + + @TableField(value = "ACTIV_DECAY_ERR") + private Double activDecayErr; + /** + * 符合相加校正因子(无设为1) + */ + @TableField(value = "CSC_RATIO") + private Double cscRatio; + /** + * 符合相加校正因子不确定度(无设为0) + */ + @TableField(value = "CSC_RATIO_ERR") + private Double cscRatioErr; + /** + * 活度是否经过符合相加校正 + */ + @TableField(value = "CSC_MOD_FLAG") + private Integer cscModFlag; + + @TableField(value = "MODDATE") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date moddate; + + @TableField(value = "MDC") + private String mdc; + + @TableField(value = "CONCENTRATION") + private String concentration; + + @TableField(value = "KEY_ENERGY") + private String keyEnergy; + + @TableField(value = "KEY_YIELD") + private String keyYield; + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsNuclLinesIdedRoi.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsNuclLinesIdedRoi.java new file mode 100644 index 00000000..3cdccc2e --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsNuclLinesIdedRoi.java @@ -0,0 +1,126 @@ +package org.jeecg.modules.base.entity.rnman; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * 存储gamma谱中识别到的峰计算结果。 + */ +@Data +@TableName("RNMAN.GARDS_NUCL_LINES_IDED_ROI") +public class GardsNuclLinesIdedRoi implements Serializable { + + /** + * 分析ID号 + */ + @TableField(value = "IDANALYSIS") + private Integer idAnalysis; + + /** + * 样品id + */ + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + + @TableField(value = "ROI_ID") + private Integer roiId; + + /** + * 峰序号 + */ + @TableField(value = "IDPEAK") + private Integer idPeak; + + /** + * 核素名称 + */ + @TableField(value = "NUCLIDENAME") + private String nuclideName; + + @TableField(value = "MODDATE") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date moddate; + + /** + * 核素库中核素对应峰的能量(keV) + */ + @TableField(value = "ENERGY") + private Double energy; + /** + * 核素库中核素对应峰的能量不确定度(keV) + */ + @TableField(value = "UNCENERGY") + private Double uncEnergy; + /** + * 核素库中核素对应峰的发射几率 + */ + @TableField(value = "ABUNDANCE") + private Double abundance; + /** + * 核素库中核素对应峰的发射几率不确定度 + */ + @TableField(value = "UNCABUNDANCE") + private Double uncAbundance; + /** + * 利用该峰计算得到的活度 + */ + @TableField(value = "ACTIVITY") + private String activity; + /** + * 利用该峰计算得到的活度不确定度 + */ + @TableField(value = "UNCACTIVITY") + private Double uncActivity; + /** + * 该峰处的探测效率 + */ + @TableField(value = "EFFIC") + private Double effic; + /** + * 该峰处的探测效率不确定度 + */ + @TableField(value = "UNEFFIC") + private Double unEffic; + /** + * 利用该峰计算得到的最小可探测活度 + */ + @TableField(value = "MDA") + private Double mda; + /** + * 主射线标识:0-否;1-是 + */ + @TableField(value = "KEY_FLAG") + private Double keyFlag; + /** + * 符合相加校正因子(无设为1) + */ + @TableField(value = "CSC_RATIO") + private Double cscRatio; + /** + * 符合相加校正因子不确定度(无设为0) + */ + @TableField(value = "CSC_RATIO_ERR") + private Double cscRatioErr; + /** + * 活度是否经过符合相加校正 + */ + @TableField(value = "CSC_MOD_FLAG") + private Double cscModFlag; + + @TableField(value = "NUCLIDEFULLNAME") + private String nuclidefullname; + + @TableField(value = "MDC") + private String mdc; + + @TableField(value = "CONCENTRATION") + private String concentration; + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsPeaksRoi.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsPeaksRoi.java new file mode 100644 index 00000000..ba04b81c --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsPeaksRoi.java @@ -0,0 +1,166 @@ +package org.jeecg.modules.base.entity.rnman; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * 存储gamma谱的寻峰结果 + */ +@Data +@TableName("RNMAN.GARDS_PEAKS_ROI") +public class GardsPeaksRoi implements Serializable { + + /** + * 样品id + */ + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + /** + * 峰序号 + */ + @TableField(value = "IDPEAK") + private Integer idPeak; + /** + * 分析ID号 + */ + @TableField(value = "IDANALYSIS") + private Integer idAnalysis; + + @TableField(value = "ROI_ID") + private Integer roiId; + + @TableField(value = "MODDATE") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date moddate; + + /** + * 峰中心道(道址) + */ + @TableField(value = "CENTROIDCHANNEL") + private Double centroidChannel; + /** + * 峰中心道不确定度(道址) + */ + @TableField(value = "UNCCENTROIDCHANNEL") + private Double uncCentroidChannel; + /** + * 峰中心道能量(keV) + */ + @TableField(value = "ENERGY") + private Double energy; + /** + * 峰中心道能量不确定度(keV) + */ + @TableField(value = "UNCENERGY") + private Double uncEnergy; + /** + * 峰面积(计数)。已扣除基线面积,但未扣除空白样品计数和探测器本底计数 + */ + @TableField(value = "AREA") + private Double area; + /** + * 峰面积不确定度(计数) + */ + @TableField(value = "UNCAREA") + private Double uncArea; + /** + * 峰的净计数率(1/s)=峰面积/活时间 + */ + @TableField(value = "NETCOUNTRATE") + private Double netCountRate; + /** + * 峰的净计数率的不确定度(1/s) + */ + @TableField(value = "UNCNETCOUNTRATE") + private Double uncNetCountRate; + /** + * 测量系统在峰能量处的绝对效率 + */ + @TableField(value = "EFFICIENCY") + private Double efficiency; + /** + * 测量系统在峰能量处的绝对效率的不确定度 + */ + @TableField(value = "UNCEFFICIENCY") + private Double uncefficiency; + /** + * 峰的半高宽(道) + */ + @TableField(value = "FWHM") + private Double fwhm; + /** + * 峰的十分之一高宽(道) + */ + @TableField(value = "FWTM") + private Double fwtm; + /** + * 峰的重要性因子 + */ + @TableField(value = "SIGNIFICANCE") + private Double significance; + /** + * 峰的可探测线Lc + */ + @TableField(value = "LC") + private Double lc; + /** + * 峰的感兴趣区的起始道 + */ + @TableField(value = "ROISTART") + private Double roiStart; + /** + * 峰的感兴趣区的结束道 + */ + @TableField(value = "ROIEND") + private Double roiEnd; + + @TableField(value = "MULTIINDEX") + private Double mulitiIndex; + + @TableField(value = "TAIL") + private Double tail; + + @TableField(value = "TAILALPHA") + private Double tailAlpha; + + @TableField(value = "UPPERTAIL") + private Double upperTail; + + @TableField(value = "UPPERTAILALPHA") + private Double upperTailAlpha; + + @TableField(value = "BWWIDTHCHAN") + private Double bwwidthchan; + + @TableField(value = "RECOILDELTACHAN") + private Double recoildeltachan; + + @TableField(value = "STEPRAIO") + private Double stepraio; + + @TableField(value = "LD") + private Double ld; + + @TableField(value = "SENSITIVITY") + private Double sensitivity; + + @TableField(value = "BACKGROUNDAREA") + private Double backgroundarea; + + @TableField(value = "MEANBACKCOUNT") + private Double meanbackcount; + + @TableField(value = "RECOILBETACHAN") + private Double recoilbetachan; + + @TableField(value = "PEAKCOMMENTS") + private String peakcomments; + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsQcCheckRoi.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsQcCheckRoi.java new file mode 100644 index 00000000..45839557 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/entity/rnman/GardsQcCheckRoi.java @@ -0,0 +1,42 @@ +package org.jeecg.modules.base.entity.rnman; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName(value = "RNMAN.GARDS_QC_CHECK_ROI") +public class GardsQcCheckRoi implements Serializable { + + @TableField(value = "SAMPLE_ID") + private Integer sampleId; + + @TableField(value = "IDANALYSIS") + private Integer idAnalysis; + + @TableField(value = "ROI_ID") + private Integer roiId; + + @TableField(value = "QC_NAME") + private String qcName; + + @TableField(value = "QC_VALUE") + private Double qcValue; + + @TableField(value = "QC_STANDARD") + private String qcStandard; + + @TableField(value = "QC_RESULT") + private Integer qcResult; + + @TableField(value = "MODDATE") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date moddate; + +} diff --git a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_C_Analysis.java b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_C_Analysis.java index 44a3ddcd..65da6a12 100644 --- a/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_C_Analysis.java +++ b/jeecg-module-auto-process/src/main/java/org/jeecg/modules/spectrum/Sample_C_Analysis.java @@ -2,12 +2,12 @@ package org.jeecg.modules.spectrum; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.ListUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.google.common.collect.HashBasedTable; import com.google.common.collect.Lists; @@ -21,7 +21,6 @@ import org.jeecg.common.constant.enums.SpectrumSystemType; import org.jeecg.common.properties.ParameterProperties; import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.util.*; -import org.jeecg.modules.ErrorLogManager; import org.jeecg.modules.base.bizVo.AttributeItemVo; import org.jeecg.modules.base.dto.*; import org.jeecg.modules.base.entity.original.GardsSampleData; @@ -30,7 +29,6 @@ import org.jeecg.modules.base.enums.DSType; import org.jeecg.modules.base.enums.MiddleDataType; import org.jeecg.modules.base.enums.SpectrumType; import org.jeecg.modules.config.datasource.DataSourceSwitcher; -import org.jeecg.modules.eneity.event.SpectrumErrorEvent; import org.jeecg.modules.entity.vo.*; import org.jeecg.modules.exception.AnalySpectrumException; import org.jeecg.modules.exception.CAnalyseException; @@ -131,6 +129,8 @@ public class Sample_C_Analysis { private PHDFile phdFile3; private PHDFile phdFile4; + private List phdFilePaths; + private Table middleDataTable; public Sample_C_Analysis(AbstractS_D_Q_G_SpectrumHandler spectrumHandler, EnergySpectrumStruct sampleStruct, SpectrumServiceQuotes serviceQuotes, @@ -287,37 +287,45 @@ public class Sample_C_Analysis { bChannels, gChannels, hCounts); // 根据ROI生成四个Gamma谱文件 文件命名格式为: 样品谱原名_ROI_x.PHD + String savePath = this.saveFullPath(); String gammaOneName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_1.PHD"; - selfStationUtil.createGammaFile(this.savePath(), gammaOneName, this.sampleStruct, roiOneCounts); + selfStationUtil.createGammaFile(savePath, gammaOneName, this.sampleStruct, roiOneCounts); String gammaTwoName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_2.PHD"; - selfStationUtil.createGammaFile(this.savePath(), gammaTwoName, this.sampleStruct, roiTwoCounts); + selfStationUtil.createGammaFile(savePath, gammaTwoName, this.sampleStruct, roiTwoCounts); String gammaThreeName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_3.PHD"; - selfStationUtil.createGammaFile(this.savePath(), gammaThreeName, this.sampleStruct, roiThreeCounts); + selfStationUtil.createGammaFile(savePath, gammaThreeName, this.sampleStruct, roiThreeCounts); String gammaFourName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_4.PHD"; - selfStationUtil.createGammaFile(this.savePath(), gammaFourName, this.sampleStruct, roiFourCounts); + selfStationUtil.createGammaFile(savePath, gammaFourName, this.sampleStruct, roiFourCounts); // 将生成的GammaPHD文件转换为PHDFile对象 - this.phdFile1 = selfStationUtil.getGammaPHD(gammaOneName, this.savePath()); + this.phdFile1 = selfStationUtil.getGammaPHD(gammaOneName, savePath); this.phdFile1.setRoiSuffix("_ROI_1"); - this.phdFile2 = selfStationUtil.getGammaPHD(gammaTwoName, this.savePath()); + this.phdFile2 = selfStationUtil.getGammaPHD(gammaTwoName, savePath); this.phdFile2.setRoiSuffix("_ROI_2"); - this.phdFile3 = selfStationUtil.getGammaPHD(gammaThreeName, this.savePath()); + this.phdFile3 = selfStationUtil.getGammaPHD(gammaThreeName, savePath); this.phdFile3.setRoiSuffix("_ROI_3"); - this.phdFile4 = selfStationUtil.getGammaPHD(gammaFourName, this.savePath()); + this.phdFile4 = selfStationUtil.getGammaPHD(gammaFourName, savePath); this.phdFile4.setRoiSuffix("_ROI_4"); + // 生成PHD的inputFileName + String saveRelativePath = this.spectrumHandler.getFileSaveRelativePath(); + gammaOneName = saveRelativePath + StrUtil.SLASH + gammaOneName; + gammaTwoName = saveRelativePath + StrUtil.SLASH + gammaTwoName; + gammaThreeName = saveRelativePath + StrUtil.SLASH + gammaThreeName; + gammaFourName = saveRelativePath + StrUtil.SLASH + gammaFourName; + phdFilePaths = ListUtil.toList(gammaOneName, gammaTwoName, gammaThreeName, gammaFourName); } /* * 获取savefile全路径 不包含文件名 * */ - public String savePath(){ + public String saveFullPath(){ spectrumPathProperties = SpringContextUtils.getBean(SpectrumPathProperties.class); String rootPath = spectrumPathProperties.getRootPath(); String saveFilePath = spectrumPathProperties.getSaveFilePath(); String saveRelativePath = this.spectrumHandler.getFileSaveRelativePath(); - return rootPath + saveFilePath + File.separator + saveRelativePath; + return rootPath + saveFilePath + StrUtil.SLASH + saveRelativePath; } /** @@ -739,10 +747,11 @@ public class Sample_C_Analysis { public void saveAnalysisROI(Integer sampleId, GStoreMiddleProcessData... middleDatas){ List analysisRois = new ArrayList<>(); - for (GStoreMiddleProcessData middleData : middleDatas) { + for (int i = 0; i < middleDatas.length; i++) { + GStoreMiddleProcessData middleData = middleDatas[i]; GardsAnalysisRoi analysisRoi = new GardsAnalysisRoi(); analysisRoi.setSampleId(sampleId); - analysisRoi.setPhdPath(this.spectrumHandler.spectrumFileRelativePath); + analysisRoi.setPhdPath(this.phdFilePaths.get(i)); analysisRoi.setBaselinePath(middleData.getAnalyses_baseline_filePath()); analysisRoi.setLcPath(middleData.getAnalyses_lc_filePath()); analysisRoi.setScacPath(middleData.getAnalyses_scac_filePath()); diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java index 83f8747e..c4696b4a 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/common/util/GammaFileUtil.java @@ -2325,6 +2325,21 @@ public class GammaFileUtil extends AbstractLogOrReport { } return bRet; } + public boolean GetInterMiddlData(List phds, String userName, List middleDatas, String flag) { + boolean bRet = true; + try { + for (int i = 0; i < phds.size(); i++) { + Map temp = new HashMap<>(); + PHDFile phd = phds.get(i); + GStoreMiddleProcessData middleData = middleDatas.get(i); + bRet = GetMiddleData(phd, userName, temp,middleData, MiddleDataType.InterAction.getType(), flag); + middleData.analyses_type ="Interactive"; + } + } catch (ParseException e) { + throw new RuntimeException(e); + } + return bRet; + } public String GetLogContent(GStoreMiddleProcessData middleData) { StringBuffer strBuffer = new StringBuffer(); diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsAnalySettingRoiMapper.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsAnalySettingRoiMapper.java new file mode 100644 index 00000000..c115c762 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsAnalySettingRoiMapper.java @@ -0,0 +1,9 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.rnman.GardsAnalySetting; +import org.jeecg.modules.base.entity.rnman.GardsAnalySettingRoi; + +public interface GardsAnalySettingRoiMapper extends BaseMapper { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsAnalysisRoiManMapper.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsAnalysisRoiManMapper.java new file mode 100644 index 00000000..f42fa88e --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsAnalysisRoiManMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.rnman.GardsAnalysisRoi; + +public interface GardsAnalysisRoiManMapper extends BaseMapper { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsCalibrationPairsRoiManMapper.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsCalibrationPairsRoiManMapper.java new file mode 100644 index 00000000..91b6da11 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsCalibrationPairsRoiManMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.rnman.GardsCalibrationPairsRoi; + +public interface GardsCalibrationPairsRoiManMapper extends BaseMapper { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsCalibrationRoiManMapper.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsCalibrationRoiManMapper.java new file mode 100644 index 00000000..41767590 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsCalibrationRoiManMapper.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.base.entity.rnman.GardsCalibrationRoi; + +import java.util.List; + +public interface GardsCalibrationRoiManMapper extends BaseMapper { + + @InterceptorIgnore(tenantLine = "true") + int createBatch(@Param("calibrationRois") List calibrationRois); +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsMdcRoiManMapper.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsMdcRoiManMapper.java new file mode 100644 index 00000000..a9c5cd5b --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsMdcRoiManMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.rnman.GardsMDCRoi; + +public interface GardsMdcRoiManMapper extends BaseMapper { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsNuclIdedRoiManMapper.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsNuclIdedRoiManMapper.java new file mode 100644 index 00000000..e7fc8856 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsNuclIdedRoiManMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.rnman.GardsNuclIdedRoi; + +public interface GardsNuclIdedRoiManMapper extends BaseMapper { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsNuclLinesIdedRoiManMapper.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsNuclLinesIdedRoiManMapper.java new file mode 100644 index 00000000..13efadea --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsNuclLinesIdedRoiManMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.rnman.GardsNuclLinesIdedRoi; + +public interface GardsNuclLinesIdedRoiManMapper extends BaseMapper { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsPeaksRoiManMapper.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsPeaksRoiManMapper.java new file mode 100644 index 00000000..09ed5aa8 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsPeaksRoiManMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.rnman.GardsPeaksRoi; + +public interface GardsPeaksRoiManMapper extends BaseMapper { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsQcCheckRoiManMapper.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsQcCheckRoiManMapper.java new file mode 100644 index 00000000..f288dd04 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/GardsQcCheckRoiManMapper.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.base.entity.rnman.GardsQcCheckRoi; + +public interface GardsQcCheckRoiManMapper extends BaseMapper { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/xml/GardsCalibrationRoiManMapper.xml b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/xml/GardsCalibrationRoiManMapper.xml new file mode 100644 index 00000000..565ebc97 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/mapper/xml/GardsCalibrationRoiManMapper.xml @@ -0,0 +1,35 @@ + + + + + + begin + + insert into RNMAN.GARDS_CALIBRATION_ROI( + SAMPLE_ID, + ROI_ID, + IDANALYSIS, + SAMPLE_TYPE, + CALTYPE, + FUNCTION, + FUNCTIONDEF, + STARTOFRANGE, + ENDOFRANGE, + COEFF_STRING, + moddate) + values + (#{calibration.sampleId}, + #{calibration.roiId}, + #{calibration.idAnalysis}, + #{calibration.sampleType}, + #{calibration.calType}, + #{calibration.function}, + #{calibration.functionDef}, + #{calibration.startOfRange}, + #{calibration.endOfRange}, + #{calibration.coeffString}, + #{calibration.moddate}) + + end; + + \ No newline at end of file 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 new file mode 100644 index 00000000..56215855 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/AnalysisManService.java @@ -0,0 +1,50 @@ +package org.jeecg.modules.service; + +import org.jeecg.modules.base.entity.rnman.GardsAnalyses; +import org.jeecg.modules.entity.vo.CalMDCInfo; +import org.jeecg.modules.entity.vo.GStoreMiddleProcessData; +import org.jeecg.modules.entity.vo.QcCheckItem; +import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct; + +import java.util.List; +import java.util.Map; + +public interface AnalysisManService { + + void middleDataTable(Integer idAnalysis, List middleDatas); + + void saveAnalysisROI(Integer sampleId, Integer idAnalysis,EnergySpectrumStruct sampleStruct, + List middleDatas, List phdFilePaths); + + void deleteAnalysisROI(Integer idAnalysis); + + void deleteCalibrationPairs(Integer idAnalysis); + + void deleteCalibration(Integer idAnalysis); + + void deletePeaks(Integer idAnalysis); + + void deleteNuclLines(Integer idAnalysis); + + void deleteNucl(Integer idAnalysis); + + void deleteQCCheck(Integer idAnalysis); + + void deleteMDC(Integer idAnalysis); + + void deleteAnalySetting(Integer idAnalysis); + + void saveCalibrationPairsROI(Integer sampleId, Integer idAnalysis); + + void saveCalibrationROI(Integer sampleId, Integer idAnalysis); + + void savePeaksROI(Integer sampleId, Integer idAnalysis); + + void saveNuclLinesIdedROI(Integer sampleId, Integer idAnalysis); + + void saveNuclIdedROI(Integer sampleId, Integer idAnalysis); + + void saveQcCheckROI(Integer sampleId, Map qcItems, Integer idAnalysis); + + void saveMDCROI(Integer sampleId, Map mdcInfoMap, Integer idAnalysis); +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsAnalySettingRoiService.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsAnalySettingRoiService.java new file mode 100644 index 00000000..51eca425 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsAnalySettingRoiService.java @@ -0,0 +1,10 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.rnman.GardsAnalySetting; +import org.jeecg.modules.base.entity.rnman.GardsAnalySettingRoi; +import org.jeecg.modules.entity.vo.PHDFile; + +public interface IGardsAnalySettingRoiService extends IService { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsAnalysisRoiManService.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsAnalysisRoiManService.java new file mode 100644 index 00000000..1f8a20a0 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsAnalysisRoiManService.java @@ -0,0 +1,13 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.rnman.GardsAnalysisRoi; + +import java.util.List; + +public interface IGardsAnalysisRoiManService extends IService { + + Integer getIdAnalysisAny(Integer sampleId); + + List analysisRoi(Integer idAnalysis); +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsCalibrationPairsRoiManService.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsCalibrationPairsRoiManService.java new file mode 100644 index 00000000..68c14496 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsCalibrationPairsRoiManService.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.rnman.GardsCalibrationPairsRoi; + +public interface IGardsCalibrationPairsRoiManService extends IService { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsCalibrationRoiManService.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsCalibrationRoiManService.java new file mode 100644 index 00000000..ffa99f79 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsCalibrationRoiManService.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.rnman.GardsCalibrationRoi; + +import java.util.List; + +public interface IGardsCalibrationRoiManService extends IService { + + int createBatch(List calibrationRois); +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsMdcRoiManService.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsMdcRoiManService.java new file mode 100644 index 00000000..d04f294c --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsMdcRoiManService.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.rnman.GardsMDCRoi; + +public interface IGardsMdcRoiManService extends IService { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsNuclIdedRoiManService.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsNuclIdedRoiManService.java new file mode 100644 index 00000000..f640603e --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsNuclIdedRoiManService.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.rnman.GardsNuclIdedRoi; + +public interface IGardsNuclIdedRoiManService extends IService { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsNuclLinesIdedRoiManService.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsNuclLinesIdedRoiManService.java new file mode 100644 index 00000000..11a059b9 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsNuclLinesIdedRoiManService.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.rnman.GardsNuclLinesIdedRoi; + +public interface IGardsNuclLinesIdedRoiManService extends IService { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsPeaksRoiManService.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsPeaksRoiManService.java new file mode 100644 index 00000000..e815cb54 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsPeaksRoiManService.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.rnman.GardsPeaksRoi; + +public interface IGardsPeaksRoiManService extends IService { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsQcCheckRoiManService.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsQcCheckRoiManService.java new file mode 100644 index 00000000..a14f4099 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/IGardsQcCheckRoiManService.java @@ -0,0 +1,8 @@ +package org.jeecg.modules.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.rnman.GardsQcCheckRoi; + +public interface IGardsQcCheckRoiManService extends IService { + +} 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 new file mode 100644 index 00000000..8e8471dd --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/AnalysisManServiceImpl.java @@ -0,0 +1,665 @@ +package org.jeecg.modules.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Lists; +import com.google.common.collect.Table; +import org.jeecg.modules.base.dto.*; +import org.jeecg.modules.base.entity.rnman.*; +import org.jeecg.modules.entity.vo.CalMDCInfo; +import org.jeecg.modules.entity.vo.GStoreMiddleProcessData; +import org.jeecg.modules.entity.vo.GStoreMiddleProcessDataNuclLinesIded; +import org.jeecg.modules.entity.vo.QcCheckItem; +import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct; +import org.jeecg.modules.service.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.lang.reflect.Field; +import java.util.*; + +import static org.jeecgframework.codegenerate.a.a.i; + +@Service +@Transactional(propagation = Propagation.REQUIRES_NEW) +public class AnalysisManServiceImpl implements AnalysisManService { + + @Autowired + private IGardsAnalysisRoiManService analysisRoiManService; + @Autowired + private IGardsCalibrationPairsRoiManService calibrationPairsRoiManService; + @Autowired + private IGardsCalibrationRoiManService calibrationRoiManService; + @Autowired + private IGardsMdcRoiManService mdcRoiManService; + @Autowired + private IGardsNuclIdedRoiManService nuclIdedRoiManService; + @Autowired + private IGardsNuclLinesIdedRoiManService nuclLinesIdedRoiManService; + @Autowired + private IGardsPeaksRoiManService peaksRoiManService; + @Autowired + private IGardsQcCheckRoiManService qcCheckRoiManService; + @Autowired + private IGardsAnalySettingRoiService analySettingRoiService; + + private Map middleDataMap; + + private final Map fieldMap = fieldMap(); + + @Override + public void middleDataTable(Integer idAnalysis, List middleDatas) { + List analysisRois = analysisRoiManService.analysisRoi(idAnalysis); + Map middleDataMap = new HashMap<>(); + for (int i = 0; i < analysisRois.size(); i++) { + GardsAnalysisRoi analysisRoi = analysisRois.get(i); + Integer roiId = analysisRoi.getRoiId(); + middleDataMap.put(roiId, middleDatas.get(i)); + } + this.middleDataMap = middleDataMap; + } + + @Override + public void saveAnalysisROI(Integer sampleId, Integer idAnalysis, EnergySpectrumStruct sampleStruct, List middleDatas, List phdFilePaths) { + List analysisRois = new ArrayList<>(); + List roiNumber = sampleStruct.ROI_number; + for (int i = 0; i < middleDatas.size(); i++) { + GStoreMiddleProcessData middleData = middleDatas.get(i); + GardsAnalysisRoi analysisRoi = new GardsAnalysisRoi(); + analysisRoi.setSampleId(sampleId); + analysisRoi.setIdAnalysis(idAnalysis); + analysisRoi.setPhdPath(phdFilePaths.get(i)); + analysisRoi.setBaselinePath(middleData.getAnalyses_baseline_filePath()); + analysisRoi.setLcPath(middleData.getAnalyses_lc_filePath()); + analysisRoi.setScacPath(middleData.getAnalyses_scac_filePath()); + analysisRoi.setLogPath(middleData.getAnalyses_LogPath()); + analysisRoi.setReportPath(middleData.getAnalyses_ReportPath()); + analysisRoi.setRoiNum(Integer.valueOf(roiNumber.get(i))); + analysisRoi.setMinX(sampleStruct.POI_B_x1.get(i)); + analysisRoi.setMaxX(sampleStruct.POI_B_x2.get(i)); + analysisRoi.setMinY(sampleStruct.POI_G_y1.get(i)); + analysisRoi.setMaxY(sampleStruct.POI_G_y2.get(i)); + analysisRois.add(analysisRoi); + } + analysisRoiManService.saveBatch(analysisRois); + } + + @Override + public void deleteAnalysisROI(Integer idAnalysis) { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(GardsAnalysisRoi::getIdAnalysis, idAnalysis); + analysisRoiManService.remove(wrapper); + } + + // 根据 IDANALYSIS 删除数据 + + @Override + public void deleteCalibrationPairs(Integer idAnalysis) { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(GardsCalibrationPairsRoi::getIdAnalysis, idAnalysis); + calibrationPairsRoiManService.remove(wrapper); + } + + @Override + public void deleteCalibration(Integer idAnalysis) { + Set idAnalysisSet = middleDataMap.rowKeySet(); + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(GardsCalibrationRoi::getIdAnalysis, idAnalysisSet); + calibrationRoiManService.remove(wrapper); + } + + @Override + public void deletePeaks(Integer idAnalysis) { + Set idAnalysisSet = middleDataMap.rowKeySet(); + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(GardsPeaksRoi::getIdAnalysis, idAnalysisSet); + peaksRoiManService.remove(wrapper); + } + + @Override + public void deleteNuclLines(Integer idAnalysis) { + Set idAnalysisSet = middleDataMap.rowKeySet(); + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(GardsNuclLinesIdedRoi::getIdAnalysis, idAnalysisSet); + nuclLinesIdedRoiManService.remove(wrapper); + } + + @Override + public void deleteNucl(Integer idAnalysis) { + Set idAnalysisSet = middleDataMap.rowKeySet(); + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(GardsNuclIdedRoi::getIdAnalysis, idAnalysisSet); + nuclIdedRoiManService.remove(wrapper); + } + + @Override + public void deleteQCCheck(Integer idAnalysis) { + Set idAnalysisSet = middleDataMap.rowKeySet(); + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(GardsQcCheckRoi::getIdAnalysis, idAnalysisSet); + qcCheckRoiManService.remove(wrapper); + } + + @Override + public void deleteMDC(Integer idAnalysis) { + Set idAnalysisSet = middleDataMap.rowKeySet(); + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(GardsMDCRoi::getIdAnalysis, idAnalysisSet); + mdcRoiManService.remove(wrapper); + } + + @Override + public void deleteAnalySetting(Integer idAnalysis) { + Set idAnalysisSet = middleDataMap.rowKeySet(); + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.in(GardsAnalySettingRoi::getIdanalysis, idAnalysisSet); + analySettingRoiService.remove(wrapper); + } + + @Override + public void saveCalibrationPairsROI(Integer sampleId, Integer idAnalysis) { + List pairsRois = new ArrayList<>(); + Set> cells = this.middleDataMap.cellSet(); + for (Table.Cell cell : cells) { + Integer IdAnalysis = cell.getRowKey(); + Integer roiId = cell.getColumnKey(); + GStoreMiddleProcessData middleData = cell.getValue(); + pairsRois.addAll(saveCalibrationPairsROI(sampleId, IdAnalysis, roiId, middleData)); + } + calibrationPairsRoiManService.saveBatch(pairsRois); + } + + public List saveCalibrationPairsROI(Integer sampleId, Integer IdAnalysis, + Integer roiId, GStoreMiddleProcessData middleData){ + String pairsSampleType = middleData.getCalibration_pairs_sample_type(); + GardsCalibrationPairsRoi pairs = new GardsCalibrationPairsRoi(); + // GARDS_CALIBRATION_PAIRS (Energy) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS + String base_E_Paris = "calibration_pairs_E_idCalPoint"; + PairsEDto pairsEDto = new PairsEDto(); + BeanUtil.copyProperties(middleData, pairsEDto); + List pairsE = Lists.newArrayList(); + if (pairsEDto.getCalibration_pairs_E_idCalPoint().size() > 0) { + pairsE = mapFields(pairsEDto, pairs, base_E_Paris, fieldMap); + String pairsECaltype = middleData.getCalibration_pairs_E_Caltype(); + String pairsEInput = middleData.getCalibration_pairs_E_Input(); + for (GardsCalibrationPairsRoi onePairs : pairsE) { + onePairs.setSampleId(sampleId); + onePairs.setRoiId(roiId); + onePairs.setIdAnalysis(IdAnalysis); + onePairs.setSampleType(pairsSampleType); + onePairs.setCaltype(pairsECaltype); + onePairs.setInput(pairsEInput); + } + } + // GARDS_CALIBRATION_PAIRS (Efficiency) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS + String base_EF_Paris = "calibration_pairs_EF_idCalPoint"; + PairsEFDto pairsEFDto = new PairsEFDto(); + BeanUtil.copyProperties(middleData, pairsEFDto); + List pairsEF = Lists.newArrayList(); + if (pairsEFDto.getCalibration_pairs_EF_idCalPoint().size() > 0) { + pairsEF = mapFields(pairsEFDto, pairs, base_EF_Paris, fieldMap); + String pairsEFCaltype = middleData.getCalibration_pairs_EF_Caltype(); + String pairsEFInput = middleData.getCalibration_pairs_EF_Input(); + for (GardsCalibrationPairsRoi onePairs : pairsEF) { + onePairs.setSampleId(sampleId); + onePairs.setRoiId(roiId); + onePairs.setIdAnalysis(IdAnalysis); + onePairs.setSampleType(pairsSampleType); + onePairs.setCaltype(pairsEFCaltype); + onePairs.setInput(pairsEFInput); + } + } + // GARDS_CALIBRATION_PAIRS (Resolution) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS + String base_R_Paris = "calibration_pairs_R_idCalPoint"; + PairsRDto pairsRDto = new PairsRDto(); + BeanUtil.copyProperties(middleData,pairsRDto); + List pairsR = Lists.newArrayList(); + if (pairsRDto.getCalibration_pairs_R_idCalPoint().size() > 0) { + pairsR = mapFields(pairsRDto, pairs, base_R_Paris, fieldMap); + String pairsRCaltype = middleData.getCalibration_pairs_R_Caltype(); + String pairsRInput = middleData.getCalibration_pairs_R_Input(); + for (GardsCalibrationPairsRoi onePairs : pairsR) { + onePairs.setSampleId(sampleId); + onePairs.setRoiId(roiId); + onePairs.setIdAnalysis(IdAnalysis); + onePairs.setSampleType(pairsSampleType); + onePairs.setCaltype(pairsRCaltype); + onePairs.setInput(pairsRInput); + } + } + // GARDS_CALIBRATION_PAIRS (TotalEfficiency) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION_PAIRS + String base_T_Paris = "calibration_pairs_T_idCalPoint"; + PairsTDto pairsTDto = new PairsTDto(); + BeanUtil.copyProperties(middleData,pairsTDto); + List pairsT = Lists.newArrayList(); + if (pairsTDto.getCalibration_pairs_T_idCalPoint().size() > 0) { + pairsT = mapFields(pairsTDto, pairs, base_T_Paris, fieldMap); + String pairsTCaltype = middleData.getCalibration_pairs_T_Caltype(); + String pairsTInput = middleData.getCalibration_pairs_T_Input(); + for (GardsCalibrationPairsRoi onePairs : pairsT) { + onePairs.setSampleId(sampleId); + onePairs.setRoiId(roiId); + onePairs.setIdAnalysis(IdAnalysis); + onePairs.setSampleType(pairsSampleType); + onePairs.setCaltype(pairsTCaltype); + onePairs.setInput(pairsTInput); + } + } + // GARDS_CALIBRATION_PAIRS 汇总保存 + List allPairs = new ArrayList<>(); + allPairs.addAll(pairsE);allPairs.addAll(pairsEF); + allPairs.addAll(pairsR);allPairs.addAll(pairsT); + return allPairs; + } + + @Override + public void saveCalibrationROI(Integer sampleId, Integer idAnalysis) { + List calibrationRois = new ArrayList<>(); + Set> cells = this.middleDataMap.cellSet(); + for (Table.Cell cell : cells) { + Integer IdAnalysis = cell.getRowKey(); + Integer roiId = cell.getColumnKey(); + GStoreMiddleProcessData middleData = cell.getValue(); + calibrationRois.addAll(saveCalibrationROI(sampleId, IdAnalysis, roiId, middleData)); + } + calibrationRoiManService.createBatch(calibrationRois); + } + + public List saveCalibrationROI(Integer sampleId, Integer IdAnalysis, Integer roiId, + GStoreMiddleProcessData middleData){ + String calibrationSampleType = middleData.getCalibration_sample_type(); + List pairsEIdCalPoint = middleData.getCalibration_pairs_E_idCalPoint(); + List pairsEFIdCalPoint = middleData.getCalibration_pairs_EF_idCalPoint(); + List pairsRIdCalPoint = middleData.getCalibration_pairs_R_idCalPoint(); + List pairsTIdCalPoint = middleData.getCalibration_pairs_T_idCalPoint(); + List calibrations = new ArrayList<>(); + // GARDS_CALIBRATION (E) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION + if (CollUtil.isNotEmpty(pairsEIdCalPoint)){ + GardsCalibrationRoi calibration = new GardsCalibrationRoi(); + calibration.setSampleId(sampleId); + calibration.setRoiId(roiId); + calibration.setIdAnalysis(IdAnalysis); + calibration.setSampleType(calibrationSampleType); + calibration.setCalType(middleData.getCalibration_E_Caltype()); + calibration.setFunction((int)middleData.getCalibration_E_function()); + calibration.setFunctionDef(middleData.getCalibration_E_functionDef()); + calibration.setStartOfRange((int)middleData.getCalibration_E_startOfRange()); + calibration.setEndOfRange((int)middleData.getCalibration_E_endOfRange()); + calibration.setCoeffString(middleData.getCalibration_E_coeff_string()); + calibration.setModdate(new Date()); + calibrations.add(calibration); + } + // GARDS_CALIBRATION (EF) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION + if (CollUtil.isNotEmpty(pairsEFIdCalPoint)){ + GardsCalibrationRoi calibration = new GardsCalibrationRoi(); + calibration.setSampleId(sampleId); + calibration.setRoiId(roiId); + calibration.setIdAnalysis(IdAnalysis); + calibration.setSampleType(calibrationSampleType); + String efCaltype = middleData.getCalibration_EF_Caltype(); + double efFunction = middleData.getCalibration_EF_function(); + String efFunctionDef = middleData.getCalibration_EF_functionDef(); + double efStartOfRange = middleData.getCalibration_EF_startOfRange(); + double efEndOfRange = middleData.getCalibration_EF_endOfRange(); + String efCoeffString = middleData.getCalibration_EF_coeff_string(); + calibration.setCalType(efCaltype); + calibration.setFunction((int)efFunction); + calibration.setFunctionDef(efFunctionDef); + calibration.setStartOfRange((int)efStartOfRange); + calibration.setEndOfRange((int)efEndOfRange); + calibration.setCoeffString(efCoeffString); + calibration.setModdate(new Date()); + calibrations.add(calibration); + } + // GARDS_CALIBRATION (R) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION + if (CollUtil.isNotEmpty(pairsRIdCalPoint)){ + GardsCalibrationRoi calibration = new GardsCalibrationRoi(); + calibration.setSampleId(sampleId); + calibration.setRoiId(roiId); + calibration.setIdAnalysis(IdAnalysis); + calibration.setSampleType(calibrationSampleType); + String rCaltype = middleData.getCalibration_R_Caltype(); + double rFunction = middleData.getCalibration_R_function(); + String rFunctionDef = middleData.getCalibration_R_functionDef(); + double rStartOfRange = middleData.getCalibration_R_startOfRange(); + double rEndOfRange = middleData.getCalibration_R_endOfRange(); + String rCoeffString = middleData.getCalibration_R_coeff_string(); + calibration.setCalType(rCaltype); + calibration.setFunction((int)rFunction); + calibration.setFunctionDef(rFunctionDef); + calibration.setStartOfRange((int)rStartOfRange); + calibration.setEndOfRange((int)rEndOfRange); + calibration.setCoeffString(rCoeffString); + calibration.setModdate(new Date()); + calibrations.add(calibration); + } + // GARDS_CALIBRATION (T) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION + if (CollUtil.isNotEmpty(pairsTIdCalPoint)){ + GardsCalibrationRoi calibration = new GardsCalibrationRoi(); + calibration.setSampleId(sampleId); + calibration.setRoiId(roiId); + calibration.setIdAnalysis(IdAnalysis); + calibration.setSampleType(calibrationSampleType); + String tCaltype = middleData.getCalibration_T_Caltype(); + double tFunction = middleData.getCalibration_T_function(); + String tFunctionDef = middleData.getCalibration_T_functionDef(); + double tStartOfRange = middleData.getCalibration_T_startOfRange(); + double tEndOfRange = middleData.getCalibration_T_endOfRange(); + String tCoeffString = middleData.getCalibration_T_coeff_string(); + calibration.setCalType(tCaltype); + calibration.setFunction((int)middleData.getCalibration_T_function()); + calibration.setFunctionDef(tFunctionDef); + calibration.setStartOfRange((int)tStartOfRange); + calibration.setEndOfRange((int)tEndOfRange); + calibration.setCoeffString(tCoeffString); + calibration.setModdate(new Date()); + calibrations.add(calibration); + } + return calibrations; + } + + @Override + public void savePeaksROI(Integer sampleId, Integer idAnalysis) { + List peaksRois = new ArrayList<>(); + Set> cells = this.middleDataMap.cellSet(); + for (Table.Cell cell : cells) { + Integer IdAnalysis = cell.getRowKey(); + Integer roiId = cell.getColumnKey(); + GStoreMiddleProcessData middleData = cell.getValue(); + peaksRois.addAll(savePeaksROI(sampleId, IdAnalysis, roiId, middleData)); + } + peaksRoiManService.saveBatch(peaksRois); + } + + public List savePeaksROI(Integer sampleId, Integer IdAnalysis, + Integer roiId, GStoreMiddleProcessData middleData){ + // Gards_Peaks_ROI数据表 ==> INSERT INTO RNAUTO.GARDS_PEAKS_ROI + String base_P_IdPeak = "peaks_idPeak"; + GardsPeaksDto gardsPeaksDto = new GardsPeaksDto(); + BeanUtil.copyProperties(middleData, gardsPeaksDto); + GardsPeaksRoi peak = new GardsPeaksRoi(); + List peaks = new ArrayList<>(); + if (CollUtil.isNotEmpty(gardsPeaksDto.getPeaks_idPeak())) { + peaks = mapFields(gardsPeaksDto, peak, base_P_IdPeak, fieldMap); + peaks.forEach(item -> { + item.setRoiId(roiId); + item.setSampleId(sampleId); + item.setIdAnalysis(IdAnalysis); + }); + } + return peaks; + } + + @Override + public void saveNuclLinesIdedROI(Integer sampleId, Integer idAnalysis){ + List linesIdedRois = new ArrayList<>(); + Set> cells = this.middleDataMap.cellSet(); + for (Table.Cell cell : cells) { + Integer IdAnalysis = cell.getRowKey(); + Integer roiId = cell.getColumnKey(); + GStoreMiddleProcessData middleData = cell.getValue(); + linesIdedRois.addAll(saveNuclLinesIdedROI(sampleId, IdAnalysis, roiId, middleData)); + } + nuclLinesIdedRoiManService.saveBatch(linesIdedRois); + } + + public List saveNuclLinesIdedROI(Integer sampleId, Integer IdAnalysis, Integer roiId, + GStoreMiddleProcessData middleData){ + // Gards_Nucl_Lines_Ided数据表 ==> INSERT INTO RNAUTO.GARDS_NUCL_LINES_IDED + Map nuclLinesIdedData = middleData.getNucl_lines_ided_data(); + String base_IdPeak = "idPeak"; + List allNuclLinesIdeds = new ArrayList<>(); + for (Map.Entry entry : nuclLinesIdedData.entrySet()) { + String nuclideName = entry.getKey(); + GStoreMiddleProcessDataNuclLinesIded nuclLinesIded = entry.getValue(); + GardsNuclLinesIdedRoi linesIdedRoi = new GardsNuclLinesIdedRoi(); + List linesIdedRois = mapFields(nuclLinesIded, linesIdedRoi, base_IdPeak, fieldMap); + if (CollUtil.isNotEmpty(linesIdedRois)){ + for (GardsNuclLinesIdedRoi idedRoi : linesIdedRois) { + idedRoi.setRoiId(roiId); + idedRoi.setSampleId(sampleId); + idedRoi.setIdAnalysis(IdAnalysis); + idedRoi.setNuclideName(nuclideName); + } + allNuclLinesIdeds.addAll(linesIdedRois); + } + } + return allNuclLinesIdeds; + } + public List saveNuclIdedROI(Integer sampleId, Integer IdAnalysis, + Integer roiId, GStoreMiddleProcessData middleData){ + // Gards_Nucl_Ided数据表 ==> INSERT INTO RNAUTO.GARDS_NUCL_IDED + GardsNuclIdedDto nuclIdedDto = new GardsNuclIdedDto(); + GardsNuclIdedRoi nuclIdedRoi = new GardsNuclIdedRoi(); + BeanUtil.copyProperties(middleData, nuclIdedDto); + List nuclIdedRois = new ArrayList<>(); + if (CollUtil.isNotEmpty(nuclIdedDto.getNucl_ided_Nuclidename())) { + String base_NuclideName = "nucl_ided_Nuclidename"; + nuclIdedRois = mapFields(nuclIdedDto, nuclIdedRoi, base_NuclideName, fieldMap); + for (GardsNuclIdedRoi idedRoi : nuclIdedRois) { + idedRoi.setRoiId(roiId); + idedRoi.setSampleId(sampleId); + idedRoi.setIdAnalysis(IdAnalysis); + } + } + return nuclIdedRois; + } + + @Override + public void saveNuclIdedROI(Integer sampleId, Integer idAnalysis){ + List idedRois = new ArrayList<>(); + Set> cells = this.middleDataMap.cellSet(); + for (Table.Cell cell : cells) { + Integer IdAnalysis = cell.getRowKey(); + Integer roiId = cell.getColumnKey(); + GStoreMiddleProcessData middleData = cell.getValue(); + idedRois.addAll(saveNuclIdedROI(sampleId, IdAnalysis, roiId, middleData)); + } + nuclIdedRoiManService.saveBatch(idedRois); + } + + public void saveQcCheckROI(Integer sampleId, Integer IdAnalysis, Integer roiId, + Map qcItems, + GStoreMiddleProcessData middleData){ + } + + @Override + public void saveQcCheckROI(Integer sampleId, Map qcItems, Integer idAnalysis){ + + } + + public List saveMDCROI(Integer sampleId, Integer IdAnalysis, + Integer roiId, Map mdcInfoMap) { + List mdcRois = new LinkedList<>(); + for (CalMDCInfo mdcInfo :mdcInfoMap.values()) { + if (ObjectUtil.isNull(mdcInfo)) continue; + if (Objects.nonNull(mdcInfo.getEnergy()) && Objects.nonNull(mdcInfo.getYield()) + && Objects.nonNull(mdcInfo.getEfficiency())) { + GardsMDCRoi mdcRoi = new GardsMDCRoi(); + mdcRoi.setRoiId(roiId); + mdcRoi.setSampleId(sampleId); + mdcRoi.setIdAnalysis(IdAnalysis); + mdcRoi.setNuclideName(mdcInfo.getNuclideName()); + mdcRoi.setEnergy(mdcInfo.getEnergy()); + mdcRoi.setYield(mdcInfo.getYield()); + mdcRoi.setEfficiency(mdcInfo.getEfficiency()); + if (Objects.nonNull(mdcInfo.getMdc()) && Double.isFinite(mdcInfo.getMdc())) { + mdcRoi.setMdc(String.valueOf(mdcInfo.getMdc())); + } else { + mdcRoi.setMdc(null); + } + mdcRoi.setMdcErr(null); + mdcRois.add(mdcRoi); + } + } + return mdcRois; + } + + @Override + public void saveMDCROI(Integer sampleId, Map mdcInfoMap, Integer idAnalysis){ + List mdcRois = new ArrayList<>(); + Set> cells = this.middleDataMap.cellSet(); + for (Table.Cell cell : cells) { + Integer IdAnalysis = cell.getRowKey(); + Integer roiId = cell.getColumnKey(); + mdcRois.addAll(saveMDCROI(sampleId, IdAnalysis, roiId, mdcInfoMap)); + } + mdcRoiManService.saveBatch(mdcRois); + } + + public Map fieldMap(){ + Map fieldMap = new HashMap<>(); + // Gards_Nucl_Lines_Ided + fieldMap.put("nuclideFullname","nuclidefullname"); + fieldMap.put("Energy","energy"); + fieldMap.put("Abundance","abundance"); + fieldMap.put("Activity","activity"); + fieldMap.put("Effic","effic"); + fieldMap.put("uncEffic","unEffic"); + fieldMap.put("Mda","mda"); + fieldMap.put("key_flag","keyFlag"); + fieldMap.put("csc_ratio","cscRatio"); + fieldMap.put("csc_ratio_err","cscRatioErr"); + fieldMap.put("csc_mod_flag","cscModFlag"); + fieldMap.put("MDC","mdc"); + fieldMap.put("Concentration","concentration"); + // Gards_Nucl_Ided + fieldMap.put("nucl_ided_Nuclidename","nuclideName"); + fieldMap.put("nucl_ided_Type","type"); + fieldMap.put("nucl_ided_Halflife","halflife"); + fieldMap.put("nucl_ided_ave_activ","aveActiv"); + fieldMap.put("nucl_ided_ave_activ_err","aveActivErr"); + fieldMap.put("nucl_ided_activ_key","activKey"); + fieldMap.put("nucl_ided_activ_key_err","activKeyErr"); + fieldMap.put("nucl_ided_mda","mda"); + fieldMap.put("nucl_ided_mda_err","mdaErr"); + fieldMap.put("nucl_ided_nid_flag","nidFlag"); + fieldMap.put("nucl_ided_csc_ratio","cscRatio"); + fieldMap.put("nucl_ided_csc_ratio_err","cscRatioErr"); + fieldMap.put("nucl_ided_csc_mod_flag","cscModFlag"); + fieldMap.put("nucl_ided_MDC","mdc"); + fieldMap.put("nucl_ided_Concentration","concentration"); + fieldMap.put("nucl_ided_Key_Energy","keyEnergy"); + fieldMap.put("nucl_ided_Key_Yield","keyYield"); + // Gards_Qc_Check + fieldMap.put("QC_CHECK_QC_NAME","qcName"); + fieldMap.put("QC_CHECK_QC_VALUE","qcValue"); + fieldMap.put("QC_CHECK_QC_STANDARD","qcStandard"); + fieldMap.put("QC_CHECK_QC_RESULT","qcResult"); + // Gards_Peaks + fieldMap.put("peaks_idPeak", "idPeak"); + fieldMap.put("peaks_peakCentroid", "centroidChannel"); + fieldMap.put("peaks_uncpeakCentroid", "uncCentroidChannel"); + fieldMap.put("peaks_Energy", "energy"); + fieldMap.put("peaks_uncEnergy", "uncEnergy"); + fieldMap.put("peaks_Area", "area"); + fieldMap.put("peaks_areaErr", "uncArea"); + fieldMap.put("peaks_netCountRate", "netCountRate"); + fieldMap.put("peaks_uncNetCountRate", "uncNetCountRate"); + fieldMap.put("peaks_Efficiency", "efficiency"); + fieldMap.put("peaks_Uncefficiency", "uncefficiency"); + fieldMap.put("peaks_Fwhm", "fwhm"); + fieldMap.put("peaks_Fwhmc", "fwtm"); + fieldMap.put("peaks_Significance", "significance"); + fieldMap.put("peaks_Sensitivity", "sensitivity"); + fieldMap.put("peaks_multiIndex", "mulitiIndex"); + fieldMap.put("peaks_ROIstart", "roiStart"); + fieldMap.put("peaks_ROIend", "roiEnd"); + fieldMap.put("peaks_tail", "tail"); + fieldMap.put("peaks_tailAlpha", "tailAlpha"); + fieldMap.put("peaks_upperTail", "upperTail"); + fieldMap.put("peaks_upperTailAlpha", "upperTailAlpha"); + fieldMap.put("peaks_BWWidthChan", "bwwidthchan"); + fieldMap.put("peaks_recoilDeltaChan", "recoildeltachan"); + fieldMap.put("peaks_stepRatio", "stepraio"); + fieldMap.put("peaks_backgroundArea", "backgroundarea"); + fieldMap.put("peaks_meanBackCount", "meanbackcount"); + fieldMap.put("peaks_Lc", "lc"); + fieldMap.put("peaks_Ld", "ld"); + // GARDS_CALIBRATION_PAIRS + fieldMap.put("calibration_pairs_E_idCalPoint","idCalPoint"); + fieldMap.put("calibration_pairs_E_xValue","xValue"); + fieldMap.put("calibration_pairs_E_yValue","yValue"); + fieldMap.put("calibration_pairs_E_uncYValue","uncYValue"); + fieldMap.put("calibration_pairs_EF_idCalPoint","idCalPoint"); + fieldMap.put("calibration_pairs_EF_xValue","xValue"); + fieldMap.put("calibration_pairs_EF_yValue","yValue"); + fieldMap.put("calibration_pairs_EF_uncYValue","uncYValue"); + fieldMap.put("calibration_pairs_R_idCalPoint","idCalPoint"); + fieldMap.put("calibration_pairs_R_xValue","xValue"); + fieldMap.put("calibration_pairs_R_yValue","yValue"); + fieldMap.put("calibration_pairs_R_uncYValue","uncYValue"); + fieldMap.put("calibration_pairs_T_idCalPoint","idCalPoint"); + fieldMap.put("calibration_pairs_T_xValue","xValue"); + fieldMap.put("calibration_pairs_T_yValue","yValue"); + fieldMap.put("calibration_pairs_T_uncYValue","uncYValue"); + return fieldMap; + } + + public List mapFields(T1 source, T2 tartget, String baseLine, Map fieldMap) { + try { + List result = new ArrayList<>(); + Class sourceClass = source.getClass(); + boolean isNumber = NumberUtil.isNumber(baseLine); + int total; + if (isNumber){ + total = Integer.parseInt(baseLine); + }else { + Field declaredField = sourceClass.getDeclaredField(baseLine); + declaredField.setAccessible(true); + List baseList = (List) declaredField.get(source); + if (CollUtil.isEmpty(baseList)) + return result; + total = baseList.size(); + } + Class tartgetClass = (Class) tartget.getClass(); + Field[] sourceFields = sourceClass.getDeclaredFields(); + for (int i = 0; i < total; i++) { + tartget = tartgetClass.newInstance(); + for (Field sourceField : sourceFields) { + try { + sourceField.setAccessible(true); + List sourceList = (List) sourceField.get(source); + if (CollUtil.isEmpty(sourceList)) + continue; + if (sourceList.size() <= i) + continue; + String value = sourceList.get(i); + if (StrUtil.isNotBlank(value)){ + String sourceFieldName = sourceField.getName(); + String targetFieldName = fieldMap.get(sourceFieldName); + targetFieldName = StrUtil.isBlank(targetFieldName) ? sourceFieldName : targetFieldName; + Field tartgetField = tartgetClass.getDeclaredField(targetFieldName); + tartgetField.setAccessible(true); + Class type = tartgetField.getType(); + if (type == String.class) { + tartgetField.set(tartget, value); + } else if (type == Integer.class || type == int.class) { + // 避免类似0.000的String值转Integer时NumberFormatException + tartgetField.set(tartget, Double.valueOf(value).intValue()); + } else if (type == Double.class || type == double.class) { + tartgetField.set(tartget, Double.valueOf(value)); + } else if (type == Boolean.class || type == boolean.class) { + tartgetField.set(tartget, Boolean.valueOf(value)); + } + } + }catch (Exception e){ + System.out.println("Sample_G_Analysis.mapFields()值映射异常: " + e.getMessage()); + } + } + result.add(tartget); + } + return result; + } catch (Exception e) { + e.printStackTrace(); + return new ArrayList<>(); + } + } +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsAnalySettingRoiServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsAnalySettingRoiServiceImpl.java new file mode 100644 index 00000000..3a0b8e90 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsAnalySettingRoiServiceImpl.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.rnman.GardsAnalySetting; +import org.jeecg.modules.base.entity.rnman.GardsAnalySettingRoi; +import org.jeecg.modules.entity.vo.PHDFile; +import org.jeecg.modules.mapper.GardsAnalySettingRoiMapper; +import org.jeecg.modules.service.IGardsAnalySettingRoiService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@DS("ora") +public class GardsAnalySettingRoiServiceImpl extends ServiceImpl implements IGardsAnalySettingRoiService { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsAnalysisRoiManServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsAnalysisRoiManServiceImpl.java new file mode 100644 index 00000000..8fb3759b --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsAnalysisRoiManServiceImpl.java @@ -0,0 +1,34 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.rnman.GardsAnalysisRoi; +import org.jeecg.modules.mapper.GardsAnalysisRoiManMapper; +import org.jeecg.modules.service.IGardsAnalysisRoiManService; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@DS("ora") +public class GardsAnalysisRoiManServiceImpl extends ServiceImpl implements IGardsAnalysisRoiManService { + + + @Override + public Integer getIdAnalysisAny(Integer sampleId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsAnalysisRoi::getSampleId, sampleId); + List analysisRois = list(wrapper); + return analysisRois.stream().findAny().orElse(new GardsAnalysisRoi()) + .getIdAnalysis(); + } + + @Override + public List analysisRoi(Integer idAnalysis) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(GardsAnalysisRoi::getIdAnalysis, idAnalysis); + wrapper.orderByAsc(GardsAnalysisRoi::getRoiNum); + return list(wrapper); + } +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsRoiAutoServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsRoiAutoServiceImpl.java index e9c20859..0aff3d23 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsRoiAutoServiceImpl.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsRoiAutoServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.service.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import org.jeecg.modules.base.entity.rnauto.GardsCalibrationPairsRoi; import org.jeecg.modules.mapper.GardsCalibrationPairsRoiMapper; import org.jeecg.modules.service.IGardsCalibrationPairsRoiAutoService; @@ -7,13 +8,8 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -/** - * @Description: - * @Author: jeecg-boot - * @Date: 2024-07-24 - * @Version: V1.0 - */ @Service +@DS("ora") public class GardsCalibrationPairsRoiAutoServiceImpl extends ServiceImpl implements IGardsCalibrationPairsRoiAutoService { } diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsRoiManServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsRoiManServiceImpl.java new file mode 100644 index 00000000..d21d411d --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsRoiManServiceImpl.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.rnman.GardsCalibrationPairsRoi; +import org.jeecg.modules.mapper.GardsCalibrationPairsRoiManMapper; +import org.jeecg.modules.service.IGardsCalibrationPairsRoiManService; +import org.springframework.stereotype.Service; + +@Service +@DS("ora") +public class GardsCalibrationPairsRoiManServiceImpl extends ServiceImpl implements IGardsCalibrationPairsRoiManService { + + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationRoiManServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationRoiManServiceImpl.java new file mode 100644 index 00000000..a2b1c297 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationRoiManServiceImpl.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.rnman.GardsCalibrationRoi; +import org.jeecg.modules.mapper.GardsCalibrationRoiManMapper; +import org.jeecg.modules.service.IGardsCalibrationRoiManService; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@DS("ora") +public class GardsCalibrationRoiManServiceImpl extends ServiceImpl implements IGardsCalibrationRoiManService { + + @Override + public int createBatch(List calibrationRois) { + return this.baseMapper.createBatch(calibrationRois); + } +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsMdcRoiAutoServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsMdcRoiAutoServiceImpl.java index 21365c2f..0fa8b1c7 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsMdcRoiAutoServiceImpl.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsMdcRoiAutoServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.service.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import org.jeecg.modules.base.entity.rnauto.GardsMDCRoi; import org.jeecg.modules.mapper.GardsMdcRoiMapper; import org.jeecg.modules.service.IGardsMdcRoiAutoService; @@ -8,6 +9,7 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service +@DS("ora") public class GardsMdcRoiAutoServiceImpl extends ServiceImpl implements IGardsMdcRoiAutoService { } diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsMdcRoiManServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsMdcRoiManServiceImpl.java new file mode 100644 index 00000000..5ff476c9 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsMdcRoiManServiceImpl.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.rnman.GardsMDCRoi; +import org.jeecg.modules.mapper.GardsMdcRoiManMapper; +import org.jeecg.modules.service.IGardsMdcRoiManService; +import org.springframework.stereotype.Service; + +@Service +@DS("ora") +public class GardsMdcRoiManServiceImpl extends ServiceImpl implements IGardsMdcRoiManService { + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedRoiAutoServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedRoiAutoServiceImpl.java index 32a59d7d..e488fcfb 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedRoiAutoServiceImpl.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedRoiAutoServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.service.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import org.jeecg.modules.base.entity.rnauto.GardsNuclIdedRoi; import org.jeecg.modules.mapper.GardsNuclIdedRoiMapper; import org.jeecg.modules.service.IGardsNuclIdedRoiAutoService; @@ -7,13 +8,8 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -/** - * @Description: - * @Author: jeecg-boot - * @Date: 2024-07-24 - * @Version: V1.0 - */ @Service +@DS("ora") public class GardsNuclIdedRoiAutoServiceImpl extends ServiceImpl implements IGardsNuclIdedRoiAutoService { } diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedRoiManServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedRoiManServiceImpl.java new file mode 100644 index 00000000..e06bb0fc --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedRoiManServiceImpl.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.rnman.GardsNuclIdedRoi; +import org.jeecg.modules.mapper.GardsNuclIdedRoiManMapper; +import org.jeecg.modules.service.IGardsNuclIdedRoiManService; +import org.springframework.stereotype.Service; + +@Service +@DS("ora") +public class GardsNuclIdedRoiManServiceImpl extends ServiceImpl implements IGardsNuclIdedRoiManService { + + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclLinesIdedRoiAutoServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclLinesIdedRoiAutoServiceImpl.java index 48d884fc..db93c003 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclLinesIdedRoiAutoServiceImpl.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclLinesIdedRoiAutoServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.service.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import org.jeecg.modules.base.entity.rnauto.GardsNuclLinesIdedRoi; import org.jeecg.modules.mapper.GardsNuclLinesIdedRoiMapper; import org.jeecg.modules.service.IGardsNuclLinesIdedRoiAutoService; @@ -7,13 +8,8 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -/** - * @Description: - * @Author: jeecg-boot - * @Date: 2024-07-24 - * @Version: V1.0 - */ @Service +@DS("ora") public class GardsNuclLinesIdedRoiAutoServiceImpl extends ServiceImpl implements IGardsNuclLinesIdedRoiAutoService { } diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclLinesIdedRoiManServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclLinesIdedRoiManServiceImpl.java new file mode 100644 index 00000000..a37fc2de --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsNuclLinesIdedRoiManServiceImpl.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.rnman.GardsNuclLinesIdedRoi; +import org.jeecg.modules.mapper.GardsNuclLinesIdedRoiManMapper; +import org.jeecg.modules.service.IGardsNuclLinesIdedRoiManService; +import org.springframework.stereotype.Service; + +@Service +@DS("ora") +public class GardsNuclLinesIdedRoiManServiceImpl extends ServiceImpl implements IGardsNuclLinesIdedRoiManService { + + +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsPeaksRoiAutoServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsPeaksRoiAutoServiceImpl.java index f626b87a..6d0a7430 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsPeaksRoiAutoServiceImpl.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsPeaksRoiAutoServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.service.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import org.jeecg.modules.base.entity.rnauto.GardsPeaksRoi; import org.jeecg.modules.mapper.GardsPeaksRoiMapper; import org.jeecg.modules.service.IGardsPeaksRoiAutoService; @@ -7,13 +8,7 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -/** - * @Description: - * @Author: jeecg-boot - * @Date: 2024-07-24 - * @Version: V1.0 - */ @Service +@DS("ora") public class GardsPeaksRoiAutoServiceImpl extends ServiceImpl implements IGardsPeaksRoiAutoService { - } diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsPeaksRoiManServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsPeaksRoiManServiceImpl.java new file mode 100644 index 00000000..a3465cf7 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsPeaksRoiManServiceImpl.java @@ -0,0 +1,13 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.rnman.GardsPeaksRoi; +import org.jeecg.modules.mapper.GardsPeaksRoiManMapper; +import org.jeecg.modules.service.IGardsPeaksRoiManService; +import org.springframework.stereotype.Service; + +@Service +@DS("ora") +public class GardsPeaksRoiManServiceImpl extends ServiceImpl implements IGardsPeaksRoiManService { +} diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsQcCheckRoiAutoServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsQcCheckRoiAutoServiceImpl.java index 8281b2ef..3351a0ac 100644 --- a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsQcCheckRoiAutoServiceImpl.java +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsQcCheckRoiAutoServiceImpl.java @@ -1,5 +1,6 @@ package org.jeecg.modules.service.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import org.jeecg.modules.base.entity.rnauto.GardsQcCheckRoi; import org.jeecg.modules.mapper.GardsQcCheckRoiMapper; import org.jeecg.modules.service.IGardsQcCheckRoiAutoService; @@ -7,13 +8,8 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -/** - * @Description: - * @Author: jeecg-boot - * @Date: 2024-07-24 - * @Version: V1.0 - */ @Service +@DS("ora") public class GardsQcCheckRoiAutoServiceImpl extends ServiceImpl implements IGardsQcCheckRoiAutoService { } diff --git a/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsQcCheckRoiManServiceImpl.java b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsQcCheckRoiManServiceImpl.java new file mode 100644 index 00000000..d7e60de9 --- /dev/null +++ b/jeecg-module-beta-gamma-analyser/src/main/java/org/jeecg/modules/service/impl/GardsQcCheckRoiManServiceImpl.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.base.entity.rnman.GardsQcCheckRoi; +import org.jeecg.modules.mapper.GardsQcCheckRoiManMapper; +import org.jeecg.modules.service.IGardsQcCheckRoiManService; +import org.springframework.stereotype.Service; + +@Service +@DS("ora") +public class GardsQcCheckRoiManServiceImpl extends ServiceImpl implements IGardsQcCheckRoiManService { + +} diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java index 08d144b6..e2b325c9 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/controller/SelfStationController.java @@ -333,4 +333,10 @@ public class SelfStationController { public Result viewSpectrum(String fileName, HttpServletRequest request) { return selfStationService.viewSpectrum(fileName, request); } + + @GetMapping("saveToDB") + @ApiOperation(value = "Save To DB按钮", notes = "Save To DB按钮") + public Result saveToDB(String fileName, HttpServletRequest request) { + return selfStationService.saveToDB(fileName, request); + } } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsAnalysesSpectrumService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsAnalysesSpectrumService.java index ffa06123..0793ca6d 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsAnalysesSpectrumService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsAnalysesSpectrumService.java @@ -12,4 +12,6 @@ public interface IGardsAnalysesSpectrumService extends IService { void updateEntity(GStoreMiddleProcessData middleData, PHDFile phd, String userName, String comments, String idAnalysis); + Integer saveAnalyses(Integer sampleId, String startTime, String userName); + } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISelfStationService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISelfStationService.java index 39b0d5d9..84ade374 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISelfStationService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/ISelfStationService.java @@ -108,4 +108,6 @@ public interface ISelfStationService { Result configureSave(ConfigureData configureData, HttpServletRequest request); Result viewSpectrum(String fileName, HttpServletRequest request); + + Result saveToDB(String fileName, HttpServletRequest request); } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsAnalysesSpectrumServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsAnalysesSpectrumServiceImpl.java index d1543cef..31cb7d60 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsAnalysesSpectrumServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsAnalysesSpectrumServiceImpl.java @@ -72,4 +72,22 @@ public class GardsAnalysesSpectrumServiceImpl extends ServiceImpl phdFilePaths; + @Override public void initValue(String dbName, Integer sampleId, String analyst, String sampleFileName, String detFileName, @@ -3449,6 +3484,320 @@ public class SelfStationServiceImpl implements ISelfStationService { return result; } + @Override + public Result saveToDB(String fileName, HttpServletRequest request) { + Result result = new Result(); + String userName = JwtUtil.getUserNameByToken(request); + boolean bRet = false; + //读取本地缓存 + Cache selfCache = selfStationCache.getSelfCache(); + SelfStationData selfStationData = selfCache.getIfPresent(fileName + StringPool.DASH + userName); + if (Objects.isNull(selfStationData)) { + result.error500("Please select the parse file first!"); + return result; + } + if (!phd.isBAnalyed()) { + result.error500("Please first Reprocessing!"); + return result; + } + //获取当前操作的台站的id + EnergySpectrumStruct sampleStruct = selfStationData.getSampleStruct(); + String siteCode = sampleStruct.site_code; + Integer stationId = spectrumAnalysisMapper.getStationId(siteCode); + //判断当前分析员当天是否有对应台站的排班任务 + List userStation = userTaskUtil.findUserStation(userName); + boolean bAnalysisResultWriteAuthority = userStation.contains(String.valueOf(stationId)); + // 获取Beta谱文件的inputFileName + String saveFileName = saveFileName(sampleStruct); + String savePathName = savePathName(sampleStruct); + String sampleInputFileName = savePathName + StrUtil.SLASH + saveFileName; + //判断当前分析员是否有过历史分析当前文件 TODO RNMAN.GARDS_ANALYSIS_ROI表没有分析员字段 + Integer isExist = spectrumAnalysisMapper.SampleIsExist(sampleInputFileName, userName); + // 如果用户没有权限操作 则查看当前用户是否是高级分析员/管理员 + if (!bAnalysisResultWriteAuthority && Objects.isNull(isExist)) { + result.error500("You have no permission to save "+siteCode+" results to DB!"); + return result; + } + // 如果有权限则开始保存数据库操作 + // 将PHDFile数据 生成用于数据库存储的数据结构 + GStoreMiddleProcessData middleData1 = new GStoreMiddleProcessData(); + GStoreMiddleProcessData middleData2 = new GStoreMiddleProcessData(); + GStoreMiddleProcessData middleData3 = new GStoreMiddleProcessData(); + GStoreMiddleProcessData middleData4 = new GStoreMiddleProcessData(); + List middleDatas = + ListUtil.toList(middleData1, middleData2, middleData3, middleData4); + List phdFiles = create4PHD(sampleStruct); + bRet = gammaFileUtil.GetInterMiddlData(phdFiles, userName, middleDatas, "save"); + if (!bRet) { + result.error500("Transform PHDFile into structGStoreMiddleProcessData failed."); + return result; + } + // 根据文件名称查询对应的sampleId 如果存在则赋值sampleId, Status 如果不存在则先存储数据信息到sampleData + PHDFile phd = new PHDFile(); + BeanUtils.copyProperties(phdFiles.get(0), phd); + GardsSampleDataSpectrum sampleData = spectrumAnalysisMapper.findSampleByFilePath(sampleInputFileName); + if (ObjectUtil.isNotNull(sampleData)) { + phd.setId_sample(sampleData.getSampleId().toString()); + phd.setStatus(sampleData.getStatus()); + } else { + // 如果sampleData为空 存储数据 + bRet = SaveSampleToDB(phd, sampleInputFileName); + if (!bRet) { + result.error500("The Database hasn't this Spectrum(" + saveFileName + ") and Insert it to Database failed."); + return result; + } + sampleData = spectrumAnalysisMapper.findSampleByFilePath(sampleInputFileName); + } + Integer sampleId = sampleData.getSampleId(); + // 根据sampleId 查询idAnalysis + String idAnalysisStr = spectrumAnalysisMapper.getIdAnalysisByIdAnalyst(sampleId.toString(), userName); + Integer idAnalysis = StrUtil.isBlank(idAnalysisStr) ? null : Integer.valueOf(idAnalysisStr); + // 写入 RNMAN数据库 + // 判断idAnalysis是否为空 + if (ObjectUtil.isNull(idAnalysis)) { + // 向 RNMAN.GARDS_ANALYSES 表插入数据 + idAnalysis = analysesSpectrumService.saveAnalyses(sampleId, phd.getAnaly_start_time(), userName); + // 向 RNMAN.GARDS_ANALYSES_ROI 表插入数据 + analysisManService.saveAnalysisROI(sampleId, idAnalysis, sampleStruct, middleDatas, this.phdFilePaths); + // 获取Table IdAnalysis:RoiId:GStoreMiddleProcessData + analysisManService.middleDataTable(idAnalysis, middleDatas); + // 修改sample_data状态 + spectrumAnalysisMapper.updateAnalysesStatus(sampleInputFileName); + } else { + // 更新 RNMAN.GARDS_ANALYSES 表数据 TODO + + // 删除 RNMAN.GARDS_ANALYSES_ROI 表数据 + analysisManService.deleteAnalysisROI(idAnalysis); + // 删除GARDS_CALIBRATION_PAIRS_ROI表数据 + analysisManService.deleteCalibrationPairs(idAnalysis); + // 删除GARDS_CALIBRATION_ROI表数据 + analysisManService.deleteCalibration(idAnalysis); + // 删除GARDS_PEAKS_ROI表数据 + analysisManService.deletePeaks(idAnalysis); + // 删除GARDS_NUCL_LINES_IDED_ROI表数据 + analysisManService.deleteNuclLines(idAnalysis); + // 删除GARDS_NUCL_IDED_ROI表数据 + analysisManService.deleteNucl(idAnalysis); + // 删除GARDS_QC_CHECK_ROI表数据 + //analysisManService.deleteQCCheck(Integer.valueOf(idAnalysis)); + // 删除GARDS_MDC_ROI表数据 + analysisManService.deleteMDC(idAnalysis); + // 删除GARDS_ANALY_SETTING_ROI表数据 + analysisManService.deleteAnalySetting(idAnalysis); + } + // 向 RNMAN.GARDS_ANALYSES_ROI 表插入数据 + analysisManService.saveAnalysisROI(sampleId, idAnalysis, sampleStruct, middleDatas, this.phdFilePaths); + // 向 RNMAN.GARDS_CALIBRATION_PAIRS 表写入 Energy 刻度数据对 + analysisManService.saveCalibrationPairsROI(sampleId, idAnalysis); + analysisManService.saveCalibrationROI(sampleId, idAnalysis); + // 向 RNMAN.GARDS_PEAKS 表写入峰信息 + analysisManService.savePeaksROI(sampleId, idAnalysis); + // 向 RNMAN.GARDS_NUCL_LINES_IDED 表写入被识别核素的射线信息 + analysisManService.saveNuclLinesIdedROI(sampleId, idAnalysis); + // 向 RNMAN.GARDS_NUCL_IDED 表写入被识别核素的活度浓度信息 + analysisManService.saveNuclIdedROI(sampleId, idAnalysis); + // 向 RNMAN.GARDS_QC_CHECK 表写入 QC 检查结果 + //analysisManService.saveQcCheckROI(sampleId, null); + // 向 RNMAN.GARDS_ANALY_SETTING 表写入 SpecSetup 分析参数设置 + analysisManService.saveAnalySettingGamma(phd, idAnalysis); + // 向 RNMAN.GARDS_MDC 表写入 MDC计算结果 TODO + analysisManService.saveMDCROI(sampleId, null, idAnalysis); + if (bRet) { + phd.setStatus("R"); + //分析成功后存储日志文件和报告文件 + for (GStoreMiddleProcessData middleData : middleDatas) { + String logFileName = middleData.analyses_absolute_LogPath.substring(middleData.analyses_absolute_LogPath.lastIndexOf(StringPool.SLASH)+1); + String rptFileName = middleData.analyses_absolute_ReportPath.substring(middleData.analyses_absolute_ReportPath.lastIndexOf(StringPool.SLASH)+1)+".txt"; + File logFile = new File(logFileName); + File rptFile = new File(rptFileName); + try { + FileUtil.writeString(gammaFileUtil.GetLogContent(middleData), logFile, "UTF-8"); + FileInputStream logIn = new FileInputStream(logFile); + ftpUtil.saveFile(spectrumPathProperties.getRootPath()+middleData.analyses_absolute_LogPath, logIn); + + FileUtil.writeString(gammaFileUtil.GetReportContent(middleData), rptFile, "UTF-8"); + FileInputStream rptIn = new FileInputStream(rptFile); + ftpUtil.saveFile(spectrumPathProperties.getRootPath()+middleData.analyses_absolute_ReportPath+".txt", rptIn); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } finally { + logFile.delete(); + rptFile.delete(); + } + } + } else { + result.error500("Save analysis results to DB failed."); + return result; + } + Map map = new HashMap<>(); + //更新detial Information + List detailedInfo = gammaFileUtil.DetailedInfo(sampleId.toString(), phd); + map.put("DetailedInformation", detailedInfo); + //发送数据到redis + /*middleData.setSample_stationID(String.valueOf(stationId)); + middleData.setSample_id(String.valueOf(phd.getId_sample())); + pushToRedis(middleData, phd);*/ + result.setSuccess(true); + result.setResult(map); + return result; + } + + @Transactional + public boolean SaveSampleToDB(PHDFile phd, String input_file_name) { + boolean bRet = false; + String sit_det_code = phd.getHeader().getSite_code(); + String detect_code = phd.getHeader().getDetector_code(); + // 查询 station_id 和 detect_id + Integer station_id = spectrumAnalysisMapper.getStationId(sit_det_code); + Integer detect_id = spectrumAnalysisMapper.getDetectorId(detect_code); + // ORIGINAL.GARDS_SAMPLE_DATA 表数据 + Integer saveSampleDataGamma = sampleDataSpectrumService.saveSampleDataGamma(phd, input_file_name, station_id, detect_id); + if (saveSampleDataGamma > 0) { + bRet = true; + } else { + bRet = false; + return bRet; + } + // 查询新增后的 sample_id 的值赋给变量 DECLARESAMPLEID + Integer sampleId = spectrumAnalysisMapper.getSampleId(input_file_name); + // ORIGINAL.GARDS_SAMPLE_AUX 表数据 + Integer saveSampleAuxGamma = sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId); + if (saveSampleAuxGamma > 0) { + bRet = true; + } else { + bRet = false; + return bRet; + } + // ORIGINAL.gards_sample_description 数据表 + sampleDescriptionSpectrumService.saveSampleDescriptionGamma(phd, sampleId); + // ORIGINAL.GARDS_SAMPLE_CERT 和 ORIGINAL.GARDS_SAMPLE_CERT_LINE 数据表 + if (phd.getCertificate().getRecord_count() > 0) { + sampleCertSpectrumService.saveSampleCertGamma(phd, sampleId); + sampleCertLineSpectrumService.saveSampleCertLineGamma(phd, sampleId); + } + // gards_ calibration_pairs_orig数据表 + Integer saveCalibrationPairsOrigGamma = calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId); + // gards_total_efficiency _pairs数据表(IDC没有) + Integer saveTotalEfficiencyPairsGamma = totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId); + // gards_spectrum数据表 + Integer saveSpectrumGamma = spectrumService.saveSpectrumGamma(phd, sampleId, input_file_name); + // 根据文件名称获取sample基础数据信息 + GardsSampleDataSpectrum samplData = spectrumAnalysisMapper.findSampleByFilePath(input_file_name); + if (Objects.nonNull(samplData)) { + phd.setId_sample(samplData.getSampleId().toString()); + phd.setStatus(samplData.getStatus()); + } + return bRet; + } + + private String saveFileName(EnergySpectrumStruct struct){ + String dataType = struct.data_type; + String measurementId = struct.measurement_id; + String spectrumQuantity = struct.spectrum_quantity; + double acquisitionLiveTime = struct.acquisition_live_time; + String suffix = nameStandUtil + .GetSuffix(dataType, spectrumQuantity, String.valueOf(acquisitionLiveTime)); + return nameStandUtil.GetFileNameFromDateTime(measurementId, suffix); + } + + private String savePathName(EnergySpectrumStruct struct){ + String dataType = struct.data_type; + String systemType = struct.system_type; + String measurementId = struct.measurement_id; + //measurement_id切割后的字符数组 + String[] arr = measurementId.split(StringConstant.DASH); + //切割后第一个,元素是年,第二个是月 + final String[] yearMonth = arr[1].split(StringConstant.SLASH); + StringBuilder relativePath = new StringBuilder(); + relativePath.append(spectrumPathProperties.getFilePathMap().get(systemType)); + relativePath.append(File.separator); + relativePath.append(spectrumPathProperties.getFilePathMap().get(dataType)); + relativePath.append(File.separator); + relativePath.append(yearMonth[0]); + relativePath.append(File.separator); + relativePath.append(yearMonth[1]); + return relativePath.toString(); + } + + private String saveFullPathName(EnergySpectrumStruct struct){ + String rootPath = spectrumPathProperties.getRootPath(); + String saveFilePath = spectrumPathProperties.getSaveFilePath(); + String saveRelativePath = savePathName(struct); + return rootPath + saveFilePath + StrUtil.SLASH + saveRelativePath; + } + + private List create4PHD(EnergySpectrumStruct sampleStruct){ + // 计算边界值 + List gEnergy = sampleStruct.g_energy; + List gCentroidChannel = sampleStruct.g_centroid_channel; + List bElectronEnergy = sampleStruct.b_electron_energy; + List bChannel = sampleStruct.b_channel; + long bChannels = sampleStruct.b_channels; + long gChannels = sampleStruct.g_channels; + List hCounts = sampleStruct.h_counts; + CalcBgBoundaryParam calcBgBoundaryParam = new CalcBgBoundaryParam(); + calcBgBoundaryParam.g_e_cal = EnergySpectrumHandler.GetFileFittingPara(gEnergy, gCentroidChannel); + calcBgBoundaryParam.b_e_cal = EnergySpectrumHandler.GetFileFittingPara(bElectronEnergy, bChannel); + calcBgBoundaryParam.b_energy = sampleStruct.b_electron_energy; + calcBgBoundaryParam.b_channel = sampleStruct.b_channel; + calcBgBoundaryParam.g_channel = sampleStruct.g_centroid_channel; + calcBgBoundaryParam.g_energy = sampleStruct.g_energy; + calcBgBoundaryParam.ROI_B_start_x1 = sampleStruct.POI_B_x1; + calcBgBoundaryParam.ROI_B_stop_x2 = sampleStruct.POI_B_x2; + calcBgBoundaryParam.ROI_G_start_y1 = sampleStruct.POI_G_y1; + calcBgBoundaryParam.ROI_G_stop_y2 = sampleStruct.POI_G_y2; + BgBoundary bgBoundary = EnergySpectrumHandler.CalcBgBoundary(calcBgBoundaryParam); + // 新Beta谱:只取X轴数据从Y轴0的位置开始连成一条线,一直到顶画出矩形框 这个矩形框内的数据就是Gamma谱数据 + List roiBBoundaryStart = bgBoundary.ROI_B_Boundary_start; + List roiBBoundaryStop = bgBoundary.ROI_B_Boundary_stop; + + // 根据范围1划分 范围1对应的折线图 + List roiOneCounts = selfStationUtil.roiList(roiBBoundaryStart.get(0), roiBBoundaryStop.get(0), + bChannels, gChannels, hCounts); + // 根据范围2划分 范围2对应的折线图 + List roiTwoCounts = selfStationUtil.roiList(roiBBoundaryStart.get(1), roiBBoundaryStop.get(1), + bChannels, gChannels, hCounts); + // 根据范围3划分 范围3对应的折线图 + List roiThreeCounts = selfStationUtil.roiList(roiBBoundaryStart.get(2), roiBBoundaryStop.get(2), + bChannels, gChannels, hCounts); + // 根据范围4划分 范围4对应的折线图 + List roiFourCounts = selfStationUtil.roiList(roiBBoundaryStart.get(3), roiBBoundaryStop.get(3), + bChannels, gChannels, hCounts); + + // 根据ROI生成四个Gamma谱文件 文件命名格式为: 样品谱原名_ROI_x.PHD + String sampleFilename = saveFileName(sampleStruct); + String saveFullPathName = saveFullPathName(sampleStruct); + + String gammaOneName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_1.PHD"; + selfStationUtil.createGammaFile(saveFullPathName, gammaOneName, sampleStruct, roiOneCounts); + + String gammaTwoName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_2.PHD"; + selfStationUtil.createGammaFile(saveFullPathName, gammaTwoName, sampleStruct, roiTwoCounts); + + String gammaThreeName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_3.PHD"; + selfStationUtil.createGammaFile(saveFullPathName, gammaThreeName, sampleStruct, roiThreeCounts); + + String gammaFourName = StrUtil.subBefore(sampleFilename, ".PHD", true) + "_ROI_4.PHD"; + selfStationUtil.createGammaFile(saveFullPathName, gammaFourName, sampleStruct, roiFourCounts); + // 将生成的GammaPHD文件转换为PHDFile对象 + PHDFile phdFile1 = selfStationUtil.getGammaPHD(gammaOneName, saveFullPathName); + phdFile1.setRoiSuffix("_ROI_1"); + PHDFile phdFile2 = selfStationUtil.getGammaPHD(gammaTwoName, saveFullPathName); + phdFile2.setRoiSuffix("_ROI_2"); + PHDFile phdFile3 = selfStationUtil.getGammaPHD(gammaThreeName, saveFullPathName); + phdFile3.setRoiSuffix("_ROI_3"); + PHDFile phdFile4 = selfStationUtil.getGammaPHD(gammaFourName, saveFullPathName); + phdFile4.setRoiSuffix("_ROI_4"); + String saveRelativePath = savePathName(sampleStruct); + String path1 = saveRelativePath + StrUtil.SLASH + gammaOneName; + String path2 = saveRelativePath + StrUtil.SLASH + gammaTwoName; + String path3 = saveRelativePath + StrUtil.SLASH + gammaThreeName; + String path4 = saveRelativePath + StrUtil.SLASH + gammaFourName; + + phdFilePaths = ListUtil.toList(path1, path2, path3, path4); + return ListUtil.toList(phdFile1, phdFile2, phdFile3, phdFile4); + } + /** * 执行gamma分析 * @param phd gamma 数据 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 856bcd79..42f1a791 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 @@ -144,7 +144,7 @@ public class SpectrumAnalysisServiceImpl extends AbstractLogOrReport implements } } - @Override + // @Override public Result getDBSearchList(HttpServletRequest request, boolean AllUsers, String sampleType) { Result result = new Result(); //接收返回结果 diff --git a/jeecg-module-system/jeecg-system-start/src/main/resources/jeecg/jeecg_config.properties b/jeecg-module-system/jeecg-system-start/src/main/resources/jeecg/jeecg_config.properties index f937776f..2a76865e 100644 --- a/jeecg-module-system/jeecg-system-start/src/main/resources/jeecg/jeecg_config.properties +++ b/jeecg-module-system/jeecg-system-start/src/main/resources/jeecg/jeecg_config.properties @@ -1,5 +1,5 @@ #code_generate_project_path -project_path=C:\\Users\\a\\Desktop +project_path=C:\\Users\\Manchester\\Desktop #bussi_package[User defined] bussi_package=org.jeecg #bussi_package=org.jeecg.modules diff --git a/jeecg-module-system/jeecg-system-start/src/main/resources/jeecg/jeecg_database.properties b/jeecg-module-system/jeecg-system-start/src/main/resources/jeecg/jeecg_database.properties index 1cd65689..35e0947b 100644 --- a/jeecg-module-system/jeecg-system-start/src/main/resources/jeecg/jeecg_database.properties +++ b/jeecg-module-system/jeecg-system-start/src/main/resources/jeecg/jeecg_database.properties @@ -13,10 +13,10 @@ #database_name=original diver_name=oracle.jdbc.driver.OracleDriver -url=jdbc:oracle:thin:@82.157.234.81:1521:orcl -username=configuration +url=jdbc:oracle:thin:@127.0.0.1:1521:ORCL +username=RNAUTO password=123456 -database_name=configuration +database_name=RNAUTO #diver_name=oracle.jdbc.driver.OracleDriver #url=jdbc:oracle:thin:@82.157.234.81:1521:orcl