From 9bf98b819c3e56bd9dcee0bd92504470147e1859 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Wed, 20 Sep 2023 19:13:44 +0800 Subject: [PATCH] =?UTF-8?q?NameStandUtil=E7=A7=BB=E5=8A=A8=E5=88=B0?= =?UTF-8?q?=E5=85=AC=E7=94=A8=E5=B7=A5=E5=85=B7=E7=B1=BB=E4=B8=AD=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9Gamma=E6=A8=A1=E5=9D=97=E4=B8=8BSaveToDB?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/jeecg/common/util/NameStandUtil.java | 0 .../org/jeecg/common/util/GammaFileUtil.java | 35 ++++++- .../modules/controller/GammaController.java | 5 + .../jeecg/modules/service/IGammaService.java | 2 + ...dsCalibrationPairsOrigSpectrumService.java | 2 +- .../IGardsSampleAuxSpectrumService.java | 2 +- .../IGardsSampleCertLineSpectrumService.java | 2 +- .../IGardsSampleCertSpectrumService.java | 2 +- .../IGardsSampleDataSpectrumService.java | 2 +- .../IGardsSpectrumSpectrumService.java | 2 +- ...dsTotalEfficiencyPairsSpectrumService.java | 2 +- .../service/impl/GammaServiceImpl.java | 91 +++++++++-------- ...librationPairsOrigSpectrumServiceImpl.java | 98 ++++++++++--------- .../GardsSampleAuxSpectrumServiceImpl.java | 8 +- ...ardsSampleCertLineSpectrumServiceImpl.java | 42 ++++---- .../GardsSampleCertSpectrumServiceImpl.java | 30 +++--- .../GardsSampleDataSpectrumServiceImpl.java | 8 +- .../GardsSpectrumSpectrumServiceImpl.java | 11 +-- ...talEfficiencyPairsSpectrumServiceImpl.java | 8 +- 19 files changed, 197 insertions(+), 155 deletions(-) rename {jeecg-module-spectrum-analysis => jeecg-boot-base-core}/src/main/java/org/jeecg/common/util/NameStandUtil.java (100%) diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/NameStandUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NameStandUtil.java similarity index 100% rename from jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/NameStandUtil.java rename to jeecg-boot-base-core/src/main/java/org/jeecg/common/util/NameStandUtil.java diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java index 7c735c30..ffd95e03 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/common/util/GammaFileUtil.java @@ -4111,7 +4111,6 @@ public class GammaFileUtil { data1.getPointlist().add(seriseData); } datalist.add(data1); - if(vEnergy.size() == size) { ChartData data2 = new ChartData(); data2.setName("Compare"); @@ -4130,4 +4129,38 @@ public class GammaFileUtil { return datalist; } + public List StripData(List m_vecCompare, List m_vCount, long m_nCount, Map colorMap, List vEnergy, Double ratioRate) { + List datalist = new LinkedList<>(); + int size = m_vecCompare.size(); + if(size == m_nCount) { + ChartData data1 = new ChartData(); + data1.setName("Compare"); + data1.setGroup("channel"); + data1.setColor(colorMap.get("Color_Strip")); + // type: 1 Add a Spectrum in Channel; -1 Cut a Spectrum in Channel + for(int i=0; i readLines); - boolean saveCalibrationPairsOrigGamma(PHDFile phd, Integer sampleId); + Integer saveCalibrationPairsOrigGamma(PHDFile phd, Integer sampleId); } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSampleAuxSpectrumService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSampleAuxSpectrumService.java index 70736435..b8f6ceaa 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSampleAuxSpectrumService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSampleAuxSpectrumService.java @@ -11,6 +11,6 @@ public interface IGardsSampleAuxSpectrumService extends IService Integer saveSampleAux(EnergySpectrumStruct sourceData, Integer sampleId, List readLines); - boolean saveSampleAuxGamma(PHDFile phd, Integer sampleId); + Integer saveSampleAuxGamma(PHDFile phd, Integer sampleId); } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSampleCertLineSpectrumService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSampleCertLineSpectrumService.java index dc95a908..0e6bb4d3 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSampleCertLineSpectrumService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSampleCertLineSpectrumService.java @@ -9,6 +9,6 @@ public interface IGardsSampleCertLineSpectrumService extends IService readLines); - boolean saveSampleDataGamma(PHDFile phd, String input_file_name, Integer station_id, Integer detect_id); + Integer saveSampleDataGamma(PHDFile phd, String input_file_name, Integer station_id, Integer detect_id); } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSpectrumSpectrumService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSpectrumSpectrumService.java index 8dbb73b5..19bebe04 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSpectrumSpectrumService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsSpectrumSpectrumService.java @@ -11,6 +11,6 @@ public interface IGardsSpectrumSpectrumService extends IService { Integer saveSpectrum(EnergySpectrumStruct sourceData, Integer sampleId, List readLines, String filePathName); - boolean saveSpectrumGamma(PHDFile phd, Integer sampleId, String input_file_name); + Integer saveSpectrumGamma(PHDFile phd, Integer sampleId, String input_file_name); } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsTotalEfficiencyPairsSpectrumService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsTotalEfficiencyPairsSpectrumService.java index 2ba2fd2a..e7a25613 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsTotalEfficiencyPairsSpectrumService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsTotalEfficiencyPairsSpectrumService.java @@ -9,6 +9,6 @@ public interface IGardsTotalEfficiencyPairsSpectrumService extends IService colorMap = sysUserColorService.initColor(userName); + //获取缓存的phd数据 + Cache phdCache = localCache.getPHDCache(); + PHDFile phd = phdCache.getIfPresent(fileName); + long m_nCount = phd.getSpec().getNum_g_channel(); + List vEnergy = phd.getVEnergy(); + long m_nSChan = phd.getSpec().getBegin_channel(); + List m_vCount = new LinkedList<>(); + // 确保绘制曲线时所有谱都是从1道开始 + int i = 0; + if(m_nSChan == 0) { + i = 1; + } + for(; i m_vecCompare = gammaFileUtil.loadCompareData(stripFileName, userName, m_nCount, result); + if (CollectionUtils.isNotEmpty(m_vecCompare)) { + List chartDataList = gammaFileUtil.StripData(m_vecCompare, m_vCount, m_nCount, colorMap, vEnergy, ratioRate); + result.setSuccess(true); + result.setResult(chartDataList); + } + return result; + } + @Override public Result configure(Integer sampleId, String fileName) { Result result = new Result(); @@ -2842,7 +2876,7 @@ public class GammaServiceImpl implements IGammaService { phd.setStatus(sampleData.getStatus()); } else { //如果sampleData为空 存储数据 - bRet = SaveSampleToDB(phd, middleData.analyses_save_filePath); + SaveSampleToDB(phd, middleData.analyses_save_filePath); } if(!bRet) { result.error500("The Database hasn't this Spectrum("+phd.getFilename()+") and Insert it to Database failed."); @@ -2936,8 +2970,7 @@ public class GammaServiceImpl implements IGammaService { } @Transactional - public boolean SaveSampleToDB(PHDFile phd, String input_file_name) { - boolean bRet = true; + public void SaveSampleToDB(PHDFile phd, String input_file_name) { String sit_det_code = phd.getHeader().getSite_code(); String detect_code = phd.getHeader().getDetector_code(); // 查询 station_id 和 detect_id @@ -2948,54 +2981,26 @@ public class GammaServiceImpl implements IGammaService { // 查询新增后的 sample_id 的值赋给变量 DECLARESAMPLEID Integer sampleId = spectrumAnalysisMapper.getSampleId(input_file_name); // ORIGINAL.GARDS_SAMPLE_AUX 表数据 - bRet = sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId); - if (!bRet) { - String Warning = "Save "+phd.getFilename()+" to original DB failed."; - return bRet; - } + sampleAuxSpectrumService.saveSampleAuxGamma(phd, sampleId); // ORIGINAL.gards_sample_description 数据表 - bRet = sampleDescriptionSpectrumService.saveSampleDescriptionGamma(phd, sampleId); - if (!bRet) { - String Warning = "Save "+phd.getFilename()+" to original DB failed."; - return bRet; - } + sampleDescriptionSpectrumService.saveSampleDescriptionGamma(phd, sampleId); // ORIGINAL.GARDS_SAMPLE_CERT 和 ORIGINAL.GARDS_SAMPLE_CERT_LINE 数据表 if(phd.getCertificate().getRecord_count() > 0) { - bRet = sampleCertSpectrumService.saveSampleCertGamma(phd, sampleId); - if (!bRet) { - String Warning = "Save "+phd.getFilename()+" to original DB failed."; - return bRet; - } - bRet = sampleCertLineSpectrumService.saveSampleCertLineGamma(phd, sampleId); - if (!bRet) { - String Warning = "Save "+phd.getFilename()+" to original DB failed."; - return bRet; - } + sampleCertSpectrumService.saveSampleCertGamma(phd, sampleId); + sampleCertLineSpectrumService.saveSampleCertLineGamma(phd, sampleId); } //gards_ calibration_pairs_orig数据表 - bRet = calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId); - if (!bRet) { - String Warning = "Save "+phd.getFilename()+" to original DB failed."; - return bRet; - } + calibrationPairsOrigSpectrumService.saveCalibrationPairsOrigGamma(phd, sampleId); // gards_total_efficiency _pairs数据表(IDC没有) - bRet = totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId); - if (!bRet) { - String Warning = "Save "+phd.getFilename()+" to original DB failed."; - return bRet; - } + totalEfficiencyPairsSpectrumService.saveTotalEfficiencyPairsGamma(phd, sampleId); //gards_spectrum数据表 - bRet = spectrumService.saveSpectrumGamma(phd, sampleId, input_file_name); - if(bRet) { - GardsSampleDataSpectrum samplData = spectrumAnalysisMapper.findSampleByFilePath(input_file_name); - if(Objects.nonNull(samplData)) { - phd.setId_sample(samplData.getSampleId().toString()); - phd.setStatus(samplData.getStatus()); - } - } else { - String Warning = "Save "+phd.getFilename()+" to original DB failed."; + 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; } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsOrigSpectrumServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsOrigSpectrumServiceImpl.java index 3872d4e1..e1a61e64 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsOrigSpectrumServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsCalibrationPairsOrigSpectrumServiceImpl.java @@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.LinkedList; import java.util.List; +import java.util.Objects; @Service("gardsCalibrationPairsOrigSpectrumService") @DS("ora") @@ -109,61 +110,66 @@ public class GardsCalibrationPairsOrigSpectrumServiceImpl extends ServiceImpl calibrationPairsOrigList = new LinkedList<>(); - int t_size = phd.getMapEnerKD().get(CalName.CalPHD.getType()).getG_energy().size(); - if(t_size > 0) { - GEnergyBlock g_ener = phd.getMapEnerKD().get(CalName.CalPHD.getType()); - for (int i=0; i 0) { + GEnergyBlock g_ener = phd.getMapEnerKD().get(CalName.CalPHD.getType()); + for (int i=0; i 0) { - GResolutionBlock g_reso = phd.getMapResoKD().get(CalName.CalPHD.getType()); - for (int i=0; i 0) { + GResolutionBlock g_reso = phd.getMapResoKD().get(CalName.CalPHD.getType()); + for (int i=0; i 0) { - GEfficiencyBlock g_effi = phd.getMapEffiKD().get(CalName.CalPHD.getType()); - for (int i=0; i 0) { + GEfficiencyBlock g_effi = phd.getMapEffiKD().get(CalName.CalPHD.getType()); + for (int i=0; i0) { - bRet = true; - } - return bRet; + return insert; } } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleCertLineSpectrumServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleCertLineSpectrumServiceImpl.java index 6fdf0e07..76a0b2c6 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleCertLineSpectrumServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleCertLineSpectrumServiceImpl.java @@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.LinkedList; import java.util.List; +import java.util.Objects; @Service("gardsSampleCertLineSpectrumService") @DS("ora") @@ -45,28 +46,29 @@ public class GardsSampleCertLineSpectrumServiceImpl extends ServiceImpl sampleCertLineList = new LinkedList<>(); - for (int i=0; i0) { - bRet = true; + public Integer saveSampleCertGamma(PHDFile phd, Integer sampleId) { + int insert = 0; + if (Objects.nonNull(phd.getCertificate())) { + String assay_date = phd.getCertificate().getAssay_date() + " " + phd.getCertificate().getAssay_time(); + try { + GardsSampleCert sampleCert = new GardsSampleCert(); + sampleCert.setSampleId(sampleId); + sampleCert.setQuantity(phd.getCertificate().getTotal_source_activity()); + sampleCert.setAssayDate(DateUtils.parseDate(assay_date)); + sampleCert.setUnit(phd.getCertificate().getUnits_activity()); + insert = this.baseMapper.insert(sampleCert); + } catch (ParseException e) { + throw new RuntimeException(e); } - } catch (ParseException e) { - throw new RuntimeException(e); } - return bRet; + return insert; } } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataSpectrumServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataSpectrumServiceImpl.java index b1303bb6..b63b90ca 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataSpectrumServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSampleDataSpectrumServiceImpl.java @@ -96,8 +96,7 @@ public class GardsSampleDataSpectrumServiceImpl extends ServiceImpl 0) { - bRet = true; - } - return bRet; + return insert; } } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSpectrumSpectrumServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSpectrumSpectrumServiceImpl.java index 8b4e43ab..23b6f4ed 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSpectrumSpectrumServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsSpectrumSpectrumServiceImpl.java @@ -55,8 +55,8 @@ public class GardsSpectrumSpectrumServiceImpl extends ServiceImpl 0) { GSpectrumBlock g_spec = phd.getSpec(); @@ -67,12 +67,9 @@ public class GardsSpectrumSpectrumServiceImpl extends ServiceImpl0) { - bRet = true; - } + insert = this.baseMapper.insert(spectrum); } - return bRet; + return insert; } } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsTotalEfficiencyPairsSpectrumServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsTotalEfficiencyPairsSpectrumServiceImpl.java index 9225ffa4..ab1ec118 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsTotalEfficiencyPairsSpectrumServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsTotalEfficiencyPairsSpectrumServiceImpl.java @@ -15,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.LinkedList; import java.util.List; +import java.util.Objects; @Service("gardsTotalEfficiencyPairsSpectrumService") @DS("ora") @@ -40,10 +41,9 @@ public class GardsTotalEfficiencyPairsSpectrumServiceImpl extends ServiceImpl totalEfficiencyPairsList = new LinkedList<>(); - int t_size = phd.getMapTotEKD().get(CalName.CalPHD.getType()).getG_energy().size(); + int t_size = Objects.nonNull(phd.getMapTotEKD().get(CalName.CalPHD.getType()).getG_energy())?phd.getMapTotEKD().get(CalName.CalPHD.getType()).getG_energy().size():0; if(t_size > 0) { TotaleffBlock g_tote = phd.getMapTotEKD().get(CalName.CalPHD.getType()); for (int i=0; i