From cf0325a63bf908e4d308075082b827437b1fdec2 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Wed, 10 Jan 2024 14:10:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=B7=A5=E4=BA=A4=E4=BA=92=EF=BC=8C?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=A4=84=E7=90=86=E5=90=AF=E5=8A=A8=E6=97=B6?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E5=85=A8=E6=A0=B8=E7=B4=A0=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E8=AE=A1=E7=AE=97mdc=E6=95=B0=E6=8D=AE=20?= =?UTF-8?q?=E5=85=AC=E7=94=A8=E5=8C=85=E4=B8=8B=E6=96=B0=E5=A2=9E=E6=A0=B8?= =?UTF-8?q?=E7=B4=A0service=E5=B1=82=E6=96=B9=E6=B3=95=E5=85=AC=E7=94=A8?= =?UTF-8?q?=E8=B0=83=E7=94=A8=20=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=85=A8=E6=A0=B8=E7=B4=A0sql=EF=BC=8C=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=A0=B8=E7=B4=A0=E5=85=B3=E8=81=94=E5=B3=B0=E6=A0=B8=E7=B4=A0?= =?UTF-8?q?sql=EF=BC=8C=E6=9F=A5=E8=AF=A2=E5=85=B3=E8=81=94=E5=8D=8A?= =?UTF-8?q?=E8=A1=B0=E6=9C=9Fsql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/mapper/GardsNuclLibMapper.java | 18 ++++++ .../base/mapper/xml/GardsNuclLibMapper.xml | 28 ++++++++ .../base/service/IGardsNuclLibService.java | 10 +++ .../service/impl/GardsNuclLibServiceImpl.java | 64 +++++++++++++++++++ .../org/jeecg/common/util/GammaFileUtil.java | 6 +- .../IGardsNuclIdedSpectrumService.java | 2 - .../GardsNuclIdedSpectrumServiceImpl.java | 58 ----------------- .../jeecg/JeecgAutoProcessApplication.java | 3 + .../JeecgSpectrumAnalysisApplication.java | 5 +- 9 files changed, 131 insertions(+), 63 deletions(-) create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclLibMapper.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/xml/GardsNuclLibMapper.xml create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/service/IGardsNuclLibService.java create mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/service/impl/GardsNuclLibServiceImpl.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclLibMapper.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclLibMapper.java new file mode 100644 index 00000000..8f2be541 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/GardsNuclLibMapper.java @@ -0,0 +1,18 @@ +package org.jeecg.modules.base.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.base.entity.configuration.GardsNuclLib; +import org.jeecg.modules.entity.vo.HalfData; +import org.jeecg.modules.entity.vo.NuclideLine; + +import java.util.List; + +public interface GardsNuclLibMapper extends BaseMapper { + + List findNuclidesAnalysis(); + + List getNuclideLines(@Param("name") String name); + + HalfData getOneHalf(@Param("name") String name); +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/xml/GardsNuclLibMapper.xml b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/xml/GardsNuclLibMapper.xml new file mode 100644 index 00000000..7ae95311 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/mapper/xml/GardsNuclLibMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/service/IGardsNuclLibService.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/service/IGardsNuclLibService.java new file mode 100644 index 00000000..2d089a70 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/service/IGardsNuclLibService.java @@ -0,0 +1,10 @@ +package org.jeecg.modules.base.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.base.entity.configuration.GardsNuclLib; + +public interface IGardsNuclLibService extends IService { + + void getNuclideMap(); + +} diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/service/impl/GardsNuclLibServiceImpl.java b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/service/impl/GardsNuclLibServiceImpl.java new file mode 100644 index 00000000..a06f1a37 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/modules/base/service/impl/GardsNuclLibServiceImpl.java @@ -0,0 +1,64 @@ +package org.jeecg.modules.base.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.util.RedisUtil; +import org.jeecg.modules.base.entity.configuration.GardsNuclLib; +import org.jeecg.modules.base.mapper.GardsNuclLibMapper; +import org.jeecg.modules.base.service.IGardsNuclLibService; +import org.jeecg.modules.entity.vo.HalfData; +import org.jeecg.modules.entity.vo.NuclideLine; +import org.jeecg.modules.entity.vo.NuclideLines; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@Service +@DS("ora") +public class GardsNuclLibServiceImpl extends ServiceImpl implements IGardsNuclLibService { + + @Autowired + private RedisUtil redisUtil; + + @Override + public void getNuclideMap() { + List nuclideLibs = this.baseMapper.findNuclidesAnalysis(); + Map nuclideMap = GetNuclideLines(nuclideLibs); + redisUtil.set("AllNuclideMap", nuclideMap); + } + + public Map GetNuclideLines(List nuclideList) { + Map mapLines = new HashMap<>(); + if (nuclideList.size() < 1) { + return mapLines; + } + for (String name : nuclideList) { + NuclideLines nlines = new NuclideLines(); + List nuclideLineList = this.baseMapper.getNuclideLines(name); + for (int j = 0; j < nuclideLineList.size(); j++) { + nlines.getFullNames().add(nuclideLineList.get(j).getFullName()); + nlines.getVenergy().add(nuclideLineList.get(j).getEnergy()); + nlines.getVuncertE().add(nuclideLineList.get(j).getEnergyUncert()); + nlines.getVyield().add(nuclideLineList.get(j).getYield() / 100); + nlines.getVuncertY().add(nuclideLineList.get(j).getYieldUncert()); + if (Objects.nonNull(nuclideLineList.get(j).getKeyFlag()) && nuclideLineList.get(j).getKeyFlag().intValue() > 0) { + nlines.key_flag = j; + nlines.maxYeildIdx = j; + } + } + mapLines.put(name, nlines); + } + for (String name:nuclideList) { + HalfData half = this.baseMapper.getOneHalf(name); + NuclideLines nuclideLines = mapLines.get(half.getName()); + nuclideLines.setHalflife(half.getHalf() == null ? 0 : half.getHalf() * 86400);// 将天转换成秒 + mapLines.put(half.getName(), nuclideLines); + } + return mapLines; + } + +} 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 d709ca18..db966246 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 @@ -59,6 +59,8 @@ public class GammaFileUtil extends AbstractLogOrReport { private NameStandUtil nameStandUtil; @Autowired private AnalysisProcess analysisProcess; + @Autowired + private RedisUtil redisUtil; public boolean loadFile(String pathName, String fileName, PHDFile phd, String sysSource, Result result) { phd.setFilepath(pathName); @@ -3198,7 +3200,9 @@ public class GammaFileUtil extends AbstractLogOrReport { fileAnlyse.setEfficiencyParam(fileAnlyse.getUsedEffiPara().getP()); fileAnlyse.setEfficiencyEnergy(fileAnlyse.getUsedEffiKD().getG_energy()); fileAnlyse.setEfficiencyCurRow(0); - getNuclideMDCValue(fileAnlyse, fileAnlyse.getMdcInfoMap(), nucline); + //缓存中获取计算mdc使用的核素信息 + Map nuclideLinesMDCMap = (Map) redisUtil.get("AllNuclideMap"); + getNuclideMDCValue(fileAnlyse, fileAnlyse.getMdcInfoMap(), nuclideLinesMDCMap); anylseEnd = DateUtils.formatDate(new Date(), "yyyy/MM/dd HH:mm:ss"); middleData.analyses_analysisBegin = anylseBegin; middleData.analyses_analysisEnd = anylseEnd; diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsNuclIdedSpectrumService.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsNuclIdedSpectrumService.java index 93aeb9cf..fe63c6ef 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsNuclIdedSpectrumService.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/IGardsNuclIdedSpectrumService.java @@ -9,6 +9,4 @@ public interface IGardsNuclIdedSpectrumService extends IService { int saveNuclIdedGamma(GStoreMiddleProcessData middleData, Integer sampleId, String idAnalysis); - void getNuclideMap(); - } diff --git a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedSpectrumServiceImpl.java b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedSpectrumServiceImpl.java index f230d55e..af7ffd10 100644 --- a/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedSpectrumServiceImpl.java +++ b/jeecg-module-spectrum-analysis/src/main/java/org/jeecg/modules/service/impl/GardsNuclIdedSpectrumServiceImpl.java @@ -2,40 +2,20 @@ package org.jeecg.modules.service.impl; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.common.constant.RedisConstant; -import org.jeecg.common.util.RedisUtil; import org.jeecg.modules.base.entity.rnman.GardsNuclIded; -import org.jeecg.modules.base.enums.SystemType; import org.jeecg.modules.entity.vo.GStoreMiddleProcessData; -import org.jeecg.modules.entity.vo.HalfData; -import org.jeecg.modules.entity.vo.NuclideLine; -import org.jeecg.modules.entity.vo.NuclideLines; import org.jeecg.modules.mapper.GardsNuclIdedSpectrumMapper; -import org.jeecg.modules.mapper.SpectrumAnalysisMapper; -import org.jeecg.modules.mapper.SysDefaultNuclideSpectrumMapper; import org.jeecg.modules.service.IGardsNuclIdedSpectrumService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; import java.util.*; -import java.util.stream.Collectors; @Service("gardsNuclIdedSpectrumService") @DS("ora") public class GardsNuclIdedSpectrumServiceImpl extends ServiceImpl implements IGardsNuclIdedSpectrumService { - @Autowired - private SpectrumAnalysisMapper spectrumAnalysisMapper; - @Autowired - private RedisUtil redisUtil; - @Override @Transactional public int saveNuclIdedGamma(GStoreMiddleProcessData middleData, Integer sampleId, String idAnalysis) { @@ -72,42 +52,4 @@ public class GardsNuclIdedSpectrumServiceImpl extends ServiceImpl nuclideLibs = spectrumAnalysisMapper.findNuclidesAnalysis(); - Map nuclideMap = GetNuclideLines(nuclideLibs); - redisUtil.set("AllNuclideMap", nuclideMap); - } - - public Map GetNuclideLines(List nuclideList) { - Map mapLines = new HashMap<>(); - if (nuclideList.size() < 1) { - return mapLines; - } - for (String name : nuclideList) { - NuclideLines nlines = new NuclideLines(); - List nuclideLineList = spectrumAnalysisMapper.getNuclideLines(name); - for (int j = 0; j < nuclideLineList.size(); j++) { - nlines.getFullNames().add(nuclideLineList.get(j).getFullName()); - nlines.getVenergy().add(nuclideLineList.get(j).getEnergy()); - nlines.getVuncertE().add(nuclideLineList.get(j).getEnergyUncert()); - nlines.getVyield().add(nuclideLineList.get(j).getYield() / 100); - nlines.getVuncertY().add(nuclideLineList.get(j).getYieldUncert()); - if (Objects.nonNull(nuclideLineList.get(j).getKeyFlag()) && nuclideLineList.get(j).getKeyFlag().intValue() > 0) { - nlines.key_flag = j; - nlines.maxYeildIdx = j; - } - } - mapLines.put(name, nlines); - } - for (String name:nuclideList) { - HalfData half = spectrumAnalysisMapper.getOneHalf(name); - NuclideLines nuclideLines = mapLines.get(half.getName()); - nuclideLines.setHalflife(half.getHalf() == null ? 0 : half.getHalf() * 86400);// 将天转换成秒 - mapLines.put(half.getName(), nuclideLines); - } - return mapLines; - } - - } diff --git a/jeecg-server-cloud/armd-auto-process-start/src/main/java/org/jeecg/JeecgAutoProcessApplication.java b/jeecg-server-cloud/armd-auto-process-start/src/main/java/org/jeecg/JeecgAutoProcessApplication.java index e42df08b..950bf372 100644 --- a/jeecg-server-cloud/armd-auto-process-start/src/main/java/org/jeecg/JeecgAutoProcessApplication.java +++ b/jeecg-server-cloud/armd-auto-process-start/src/main/java/org/jeecg/JeecgAutoProcessApplication.java @@ -9,6 +9,7 @@ import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.TaskProperties; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.*; +import org.jeecg.modules.base.service.IGardsNuclLibService; import org.jeecg.modules.email.EmailReceivePolicy; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; @@ -44,6 +45,7 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im private final FileSourceHandleManager fileSourceHandleManager; private final DelFileManager delFileManager; private final StatReportManager statReportManager; + private final IGardsNuclLibService nuclLibService; @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { @@ -69,6 +71,7 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im //调用dll System.loadLibrary("ReadPHDFile"); System.loadLibrary("GammaAnaly"); + nuclLibService.getNuclideMap(); //根据配置文件配置邮件获取策略定义时间条件,默认EmailReceivePolicy.HISTORY_ORDER_RECEIVE.getPolicy() Date systemStartupTime = null; if(EmailReceivePolicy.CURR_DATE_ORDER_RECEIVE.getPolicy().equals(taskProperties.getReceivePolicy())){ diff --git a/jeecg-server-cloud/armd-spectrum-analysis-start/src/main/java/org/jeecg/JeecgSpectrumAnalysisApplication.java b/jeecg-server-cloud/armd-spectrum-analysis-start/src/main/java/org/jeecg/JeecgSpectrumAnalysisApplication.java index 09def5e3..8f32c573 100644 --- a/jeecg-server-cloud/armd-spectrum-analysis-start/src/main/java/org/jeecg/JeecgSpectrumAnalysisApplication.java +++ b/jeecg-server-cloud/armd-spectrum-analysis-start/src/main/java/org/jeecg/JeecgSpectrumAnalysisApplication.java @@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j; import org.jeecg.common.cache.BetaCache; import org.jeecg.common.cache.LocalCache; import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.base.service.IGardsNuclLibService; import org.jeecg.modules.service.IDataService; import org.jeecg.modules.service.IGammaService; import org.jeecg.modules.service.IGardsNuclCoincidenceSumSpectrumService; @@ -36,7 +37,7 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ @Autowired private IGardsNuclCoincidenceSumSpectrumService nuclCoincidenceSumSpectrumService; @Autowired - private IGardsNuclIdedSpectrumService nuclIdedSpectrumService; + private IGardsNuclLibService nuclLibService; @Autowired private IDataService dataService; @@ -72,7 +73,7 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ betaCache.initCache(); localCache.initCache(); gammaService.readMDCParameter(); - nuclIdedSpectrumService.getNuclideMap(); + nuclLibService.getNuclideMap(); nuclCoincidenceSumSpectrumService.getNuclCoincidenceMap(); dataService.viewStations(); }