Merge remote-tracking branch 'origin/mdc' into mdc

This commit is contained in:
nieziyan 2024-01-09 20:46:14 +08:00
commit 11e76c0c38
14 changed files with 136 additions and 30 deletions

View File

@ -0,0 +1,14 @@
package org.jeecg.common.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "maximum")
public class MaximumPoolSizeProperties {
private Integer station;
}

View File

@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import org.jeecg.common.constant.RedisConstant; import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.exception.StreamErrorHandler; import org.jeecg.common.exception.StreamErrorHandler;
import org.jeecg.common.properties.MaximumPoolSizeProperties;
import org.jeecg.common.util.RedisStreamUtil; import org.jeecg.common.util.RedisStreamUtil;
import org.jeecg.modules.base.dto.Info; import org.jeecg.modules.base.dto.Info;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
@ -46,6 +48,9 @@ public class RedisStreamConfig {
@Resource @Resource
private RedisStreamUtil redisStreamUtil; private RedisStreamUtil redisStreamUtil;
@Autowired
private MaximumPoolSizeProperties maximumPoolSizeProperties;
@Bean(initMethod = "start", destroyMethod = "stop") @Bean(initMethod = "start", destroyMethod = "stop")
public StreamMessageListenerContainer<String, ObjectRecord<String, Info>> alarmStream() { public StreamMessageListenerContainer<String, ObjectRecord<String, Info>> alarmStream() {
/* 创建Stream和消费组 */ /* 创建Stream和消费组 */
@ -53,7 +58,7 @@ public class RedisStreamConfig {
// 原子整数,多线程环境下对整数的原子性操作 // 原子整数,多线程环境下对整数的原子性操作
AtomicInteger index = new AtomicInteger(1); AtomicInteger index = new AtomicInteger(1);
// 返回当前系统可用的处理器数量 // 返回当前系统可用的处理器数量
Integer processors = Runtime.getRuntime().availableProcessors(); Integer processors = maximumPoolSizeProperties.getStation();//Runtime.getRuntime().availableProcessors();
/* /*
corePoolSize线程池中核心线程的数量,即线程池中保持的最小线程数 corePoolSize线程池中核心线程的数量,即线程池中保持的最小线程数
maximumPoolSize线程池中允许的最大线程数 maximumPoolSize线程池中允许的最大线程数

View File

@ -80,6 +80,8 @@ public interface SpectrumAnalysisMapper {
List<HalfData> getHalf(@Param(value = "names") List<String> names); List<HalfData> getHalf(@Param(value = "names") List<String> names);
HalfData getOneHalf(@Param(value = "name") String name);
List<String> UserNuclide(@Param(value = "systemType") String systemType, @Param(value = "userName") String userName); List<String> UserNuclide(@Param(value = "systemType") String systemType, @Param(value = "userName") String userName);
Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName); Integer getAnalysisID(@Param(value = "dbName") String dbName, @Param(value = "sampleId") Integer sampleId, @Param(value = "userName") String userName);
@ -175,4 +177,6 @@ public interface SpectrumAnalysisMapper {
Integer getSampleIdLikeFileName(@Param(value = "fileName") String fileName); Integer getSampleIdLikeFileName(@Param(value = "fileName") String fileName);
List<String> findNuclidesAnalysis();
} }

View File

@ -589,6 +589,15 @@
</foreach> </foreach>
</select> </select>
<select id="getOneHalf" resultType="org.jeecg.modules.entity.vo.HalfData">
SELECT
NAME as name,
HALFLIFE as half
FROM
CONFIGURATION.GARDS_NUCL_LIB
WHERE NAME = #{name}
</select>
<select id="UserNuclide" resultType="java.lang.String"> <select id="UserNuclide" resultType="java.lang.String">
SELECT nuclide_name FROM sys_default_nuclide where use_type = 3 and nuclide_type = #{systemType} and create_by = #{userName} SELECT nuclide_name FROM sys_default_nuclide where use_type = 3 and nuclide_type = #{systemType} and create_by = #{userName}
</select> </select>
@ -1084,4 +1093,8 @@
select SAMPLE_ID from ORIGINAL.GARDS_SAMPLE_DATA WHERE INPUT_FILE_NAME LIKE CONCAT('%', #{fileName}) select SAMPLE_ID from ORIGINAL.GARDS_SAMPLE_DATA WHERE INPUT_FILE_NAME LIKE CONCAT('%', #{fileName})
</select> </select>
<select id="findNuclidesAnalysis" resultType="java.lang.String">
select NAME from CONFIGURATION.GARDS_NUCL_LIB
</select>
</mapper> </mapper>

View File

@ -9,4 +9,6 @@ public interface IGardsNuclIdedSpectrumService extends IService<GardsNuclIded> {
int saveNuclIdedGamma(GStoreMiddleProcessData middleData, Integer sampleId, String idAnalysis); int saveNuclIdedGamma(GStoreMiddleProcessData middleData, Integer sampleId, String idAnalysis);
void getNuclideMap();
} }

View File

@ -24,6 +24,7 @@ import org.jeecg.common.api.QueryRequest;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.cache.LocalCache; import org.jeecg.common.cache.LocalCache;
import org.jeecg.common.constant.DateConstant; import org.jeecg.common.constant.DateConstant;
import org.jeecg.common.constant.RedisConstant;
import org.jeecg.common.properties.ParameterProperties; import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.properties.SpectrumPathProperties; import org.jeecg.common.properties.SpectrumPathProperties;
import org.jeecg.common.system.util.JwtUtil; import org.jeecg.common.system.util.JwtUtil;
@ -1280,7 +1281,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy()); phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy());
phd.setEfficiencyCurRow(0); phd.setEfficiencyCurRow(0);
// 重新计算峰值 // 重新计算峰值
gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMap); Map<String, NuclideLines> nuclideLinesMDCMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");
gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMDCMap);
String warning = "Finish three tasks:\n" + String warning = "Finish three tasks:\n" +
"\t1.Update efficiencies of all peaks;\n" + "\t1.Update efficiencies of all peaks;\n" +
"\t2.Identify nuclides again;\n" + "\t2.Identify nuclides again;\n" +
@ -1295,7 +1297,8 @@ public class GammaServiceImpl extends AbstractLogOrReport implements IGammaServi
phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy()); phd.setEfficiencyEnergy(phd.getUsedEffiKD().getG_energy());
phd.setEfficiencyCurRow(0); phd.setEfficiencyCurRow(0);
// 重新计算峰值 // 重新计算峰值
gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMap); Map<String, NuclideLines> nuclideLinesMDCMap = (Map<String, NuclideLines>) redisUtil.get("AllNuclideMap");
gammaFileUtil.getNuclideMDCValue(phd, phd.getMdcInfoMap(), nuclideLinesMDCMap);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
gammaFileUtil.UpdateChart(phd, map, colorMap); gammaFileUtil.UpdateChart(phd, map, colorMap);
// 更新 QC Flags 状态 // 更新 QC Flags 状态

View File

@ -2,21 +2,39 @@ package org.jeecg.modules.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.entity.rnman.GardsNuclIded;
import org.jeecg.modules.base.enums.SystemType;
import org.jeecg.modules.entity.vo.GStoreMiddleProcessData; 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.GardsNuclIdedSpectrumMapper;
import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
import org.jeecg.modules.mapper.SysDefaultNuclideSpectrumMapper;
import org.jeecg.modules.service.IGardsNuclIdedSpectrumService; import org.jeecg.modules.service.IGardsNuclIdedSpectrumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.LinkedList; import java.sql.Connection;
import java.util.List; import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.*;
import java.util.stream.Collectors;
@Service("gardsNuclIdedSpectrumService") @Service("gardsNuclIdedSpectrumService")
@DS("ora") @DS("ora")
public class GardsNuclIdedSpectrumServiceImpl extends ServiceImpl<GardsNuclIdedSpectrumMapper, GardsNuclIded> implements IGardsNuclIdedSpectrumService { public class GardsNuclIdedSpectrumServiceImpl extends ServiceImpl<GardsNuclIdedSpectrumMapper, GardsNuclIded> implements IGardsNuclIdedSpectrumService {
@Autowired
private SpectrumAnalysisMapper spectrumAnalysisMapper;
@Autowired
private RedisUtil redisUtil;
@Override @Override
@Transactional @Transactional
@ -54,4 +72,42 @@ public class GardsNuclIdedSpectrumServiceImpl extends ServiceImpl<GardsNuclIdedS
return nuclIdedList.size(); return nuclIdedList.size();
} }
@Override
public void getNuclideMap() {
List<String> nuclideLibs = spectrumAnalysisMapper.findNuclidesAnalysis();
Map<String, NuclideLines> nuclideMap = GetNuclideLines(nuclideLibs);
redisUtil.set("AllNuclideMap", nuclideMap);
}
public Map<String, NuclideLines> GetNuclideLines(List<String> nuclideList) {
Map<String, NuclideLines> mapLines = new HashMap<>();
if (nuclideList.size() < 1) {
return mapLines;
}
for (String name : nuclideList) {
NuclideLines nlines = new NuclideLines();
List<NuclideLine> 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;
}
} }

View File

@ -3,6 +3,7 @@ package org.jeecg;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.CalculateStationData; import org.jeecg.common.CalculateStationData;
import org.jeecg.common.properties.MaximumPoolSizeProperties;
import org.jeecg.common.util.RedisUtil; import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.entity.configuration.GardsStations; import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.modules.entity.data.RateParam; import org.jeecg.modules.entity.data.RateParam;
@ -26,6 +27,8 @@ public class DataProvisionEfficiencyManager {
private final CalculateStationData calCulateStationData; private final CalculateStationData calCulateStationData;
private final MaximumPoolSizeProperties maximumPoolSizeProperties;
/** /**
* 开始 * 开始
*/ */
@ -44,7 +47,7 @@ public class DataProvisionEfficiencyManager {
public void init(){ public void init(){
//获取机器可用核心数 //获取机器可用核心数
int systemCores = Runtime.getRuntime().availableProcessors(); int systemCores = maximumPoolSizeProperties.getStation();//Runtime.getRuntime().availableProcessors();
//初始化线程池 //初始化线程池
ThreadFactory threadFactory = new CustomizableThreadFactory("provision-efficiency-"); ThreadFactory threadFactory = new CustomizableThreadFactory("provision-efficiency-");
poolExecutor = new ThreadPoolExecutor(systemCores-1,systemCores,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory); poolExecutor = new ThreadPoolExecutor(systemCores-1,systemCores,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory);

View File

@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.CacheName; import org.jeecg.common.CacheName;
import org.jeecg.common.config.mqtoken.UserTokenContext; import org.jeecg.common.config.mqtoken.UserTokenContext;
import org.jeecg.common.properties.MaximumPoolSizeProperties;
import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.RedisUtil; import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.entity.original.GardsMetData; import org.jeecg.modules.base.entity.original.GardsMetData;
@ -47,6 +48,8 @@ public class DataReceivingStatusManager {
private final StationSohDataMapper stationSohDataMapper; private final StationSohDataMapper stationSohDataMapper;
private final MaximumPoolSizeProperties maximumPoolSizeProperties;
public void start() { public void start() {
ReceivingStatusThreadManager receivingStatusManager = new ReceivingStatusThreadManager(); ReceivingStatusThreadManager receivingStatusManager = new ReceivingStatusThreadManager();
receivingStatusManager.init(); receivingStatusManager.init();
@ -62,7 +65,7 @@ public class DataReceivingStatusManager {
public void init(){ public void init(){
//获取机器可用核心数 //获取机器可用核心数
int systemCores = Runtime.getRuntime().availableProcessors(); int systemCores = maximumPoolSizeProperties.getStation();//Runtime.getRuntime().availableProcessors();
//初始化线程池 //初始化线程池
ThreadFactory threadFactory = new CustomizableThreadFactory("undeal-file-parsing-"); ThreadFactory threadFactory = new CustomizableThreadFactory("undeal-file-parsing-");
poolExecutor = new ThreadPoolExecutor(systemCores-1,systemCores,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory); poolExecutor = new ThreadPoolExecutor(systemCores-1,systemCores,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory);

View File

@ -1,6 +1,7 @@
package org.jeecg.common; package org.jeecg.common;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.properties.MaximumPoolSizeProperties;
import org.jeecg.common.properties.ParameterProperties; import org.jeecg.common.properties.ParameterProperties;
import org.jeecg.common.util.RedisUtil; import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.entity.data.*; import org.jeecg.modules.entity.data.*;
@ -25,6 +26,8 @@ public class CalculateStationData {
@Autowired @Autowired
private ParameterProperties parameterProperties; private ParameterProperties parameterProperties;
@Autowired @Autowired
private MaximumPoolSizeProperties maximumPoolSizeProperties;
@Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
/** /**
@ -837,7 +840,7 @@ public class CalculateStationData {
// 如果线程数不等于0 // 如果线程数不等于0
if (threadNum != 0){ if (threadNum != 0){
//获取机器可用核心数 //获取机器可用核心数
int maximumPoolSize = Runtime.getRuntime().availableProcessors(); int maximumPoolSize = maximumPoolSizeProperties.getStation();//Runtime.getRuntime().availableProcessors();
//初始化线程池 //初始化线程池
ThreadFactory threadFactory = new ThreadFactory() { ThreadFactory threadFactory = new ThreadFactory() {
@Override @Override

View File

@ -147,6 +147,7 @@ public class GardsSampleDataWebServiceImpl extends ServiceImpl<GardsSampleDataWe
if (StringUtils.isNotBlank(filePath)) { if (StringUtils.isNotBlank(filePath)) {
file = ftpUtil.downloadFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath, "betaGamma"); file = ftpUtil.downloadFile(ftpUtil.getFtpRootPath() + spectrumPathProperties.getSaveFilePath() + StringPool.SLASH + filePath, "betaGamma");
if (Objects.nonNull(file)) { if (Objects.nonNull(file)) {
// System.load("/usr/local/jdk/lib/libReadPHDFile.so");
System.loadLibrary("ReadPHDFile"); System.loadLibrary("ReadPHDFile");
EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath()); EnergySpectrumStruct sourceData = EnergySpectrumHandler.getSourceData(file.getAbsolutePath());
//查询info //查询info

View File

@ -12,6 +12,17 @@
<artifactId>armd-abnormal-alarm-start</artifactId> <artifactId>armd-abnormal-alarm-start</artifactId>
<dependencies> <dependencies>
<!-- 引入jeecg-boot-starter-cloud依赖 -->
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-starter-cloud</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-base-core</artifactId>
</dependency>
<!-- jeecg-module-abnormal-alarm模块 --> <!-- jeecg-module-abnormal-alarm模块 -->
<dependency> <dependency>
<groupId>org.jeecgframework.boot</groupId> <groupId>org.jeecgframework.boot</groupId>
@ -34,26 +45,6 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<!--以下配置用于在打包时添加自己引入的<scope>system</scope>-->
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
<!--<configuration>
<layout>ZIP</layout>
<includes>
<include>
<groupId>nothing</groupId>
<artifactId>nothing</artifactId>
</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>-->
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -16,4 +16,5 @@ spring:
import: import:
- optional:nacos:armd.yaml - optional:nacos:armd.yaml
- optional:nacos:IDC-Data.yaml - optional:nacos:IDC-Data.yaml
- optional:nacos:armd-@profile.name@.yaml - optional:nacos:armd-@profile.name@.yaml
- optional:nacos:armd-analysis-@profile.name@.yaml

View File

@ -7,6 +7,7 @@ import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.service.IDataService; import org.jeecg.modules.service.IDataService;
import org.jeecg.modules.service.IGammaService; import org.jeecg.modules.service.IGammaService;
import org.jeecg.modules.service.IGardsNuclCoincidenceSumSpectrumService; import org.jeecg.modules.service.IGardsNuclCoincidenceSumSpectrumService;
import org.jeecg.modules.service.IGardsNuclIdedSpectrumService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
@ -35,6 +36,8 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
@Autowired @Autowired
private IGardsNuclCoincidenceSumSpectrumService nuclCoincidenceSumSpectrumService; private IGardsNuclCoincidenceSumSpectrumService nuclCoincidenceSumSpectrumService;
@Autowired @Autowired
private IGardsNuclIdedSpectrumService nuclIdedSpectrumService;
@Autowired
private IDataService dataService; private IDataService dataService;
@ -59,13 +62,17 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
@Override @Override
public void run(String... args) throws Exception { public void run(String... args) throws Exception {
//加载dll工具库 //Windows加载dll工具库
System.loadLibrary("ReadPHDFile"); System.loadLibrary("ReadPHDFile");
System.loadLibrary("GammaAnaly"); System.loadLibrary("GammaAnaly");
//Linux版本加载dll工具库
// System.load("/usr/local/jdk/lib/libReadPHDFile.so");
// System.load("/usr/local/jdk/lib/libGammaAnalyALG.so");
//创建缓存 //创建缓存
betaCache.initCache(); betaCache.initCache();
localCache.initCache(); localCache.initCache();
gammaService.readMDCParameter(); gammaService.readMDCParameter();
nuclIdedSpectrumService.getNuclideMap();
nuclCoincidenceSumSpectrumService.getNuclCoincidenceMap(); nuclCoincidenceSumSpectrumService.getNuclCoincidenceMap();
dataService.viewStations(); dataService.viewStations();
} }