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

This commit is contained in:
nieziyan 2023-11-21 18:41:37 +08:00
commit 5ab82f8883
7 changed files with 89 additions and 66 deletions

View File

@ -130,12 +130,12 @@ public class Sample_G_Analysis {
sampleFilePath.substring(0, sampleFilePath.lastIndexOf(StringPool.SLASH));
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
// 解析能谱文件
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phdFile, new Result());
// 获取数据库 Gamma 默认参数
getSettingFromDB(phdFile);
// 解析能谱文件
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phdFile, new Result());
// 文件路径
middleData.setAnalyses_save_filePath(this.sampleInputFilename);
// 读取文件内容并附值
@ -253,19 +253,19 @@ public class Sample_G_Analysis {
// Reading gamma Efficiency pairs(sampleID: %1)
writes.add(MyLogFormatUtil.getHeaderFormat(MyLogFormatUtil.GSetSampleEfficiencyChannel.replace("%1", sampleId)));
data.clear();
item = new AttributeItemVo("Channel", MyLogFormatUtil.getValuePoint(middleData.getCalibration_pairs_S_EF_xValue(), 3));
data.add(item);
item = new AttributeItemVo("Energy", MyLogFormatUtil.getValuePoint(middleData.getCalibration_pairs_S_EF_xValue(), 3));
item = new AttributeItemVo("Energy", MyLogFormatUtil.getValuePoint(middleData.getCalibration_pairs_S_EF_yValue(), 3));
data.add(item);
item = new AttributeItemVo("Error", MyLogFormatUtil.getValuePoint(middleData.getCalibration_pairs_S_EF_xValue(), 3));
item = new AttributeItemVo("Error", MyLogFormatUtil.getValuePoint(middleData.getCalibration_pairs_S_EF_uncYValue(), 3));
data.add(item);
writes.addAll(MyLogFormatUtil.getBlockContext(data));
// Reading gamma Resolution pairs(sampleID: %1)
writes.add(MyLogFormatUtil.getHeaderFormat(MyLogFormatUtil.GSetSampleResolutionChannel.replace("%1", sampleId)));
item = new AttributeItemVo("Channel", MyLogFormatUtil.getValuePoint(middleData.getCalibration_pairs_S_EF_xValue(), 3));
data.clear();
item = new AttributeItemVo("Channel", MyLogFormatUtil.getValuePoint(middleData.getCalibration_pairs_S_R_xValue(), 3));
data.add(item);
item = new AttributeItemVo("Energy", MyLogFormatUtil.getValuePoint(middleData.getCalibration_pairs_S_R_yValue(),3));
data.add(item);
@ -275,6 +275,7 @@ public class Sample_G_Analysis {
// Reading gamma TotalEfficiency pairs(sampleID: %1)
writes.add(MyLogFormatUtil.getHeaderFormat(MyLogFormatUtil.GSetSampleTotalEfficiencyChannel.replace("%1", sampleId)));
data.clear();
item = new AttributeItemVo("Channel", middleData.getCalibration_pairs_S_T_xValue());
data.add(item);
item = new AttributeItemVo("Energy", MyLogFormatUtil.getValuePoint(middleData.getCalibration_pairs_S_T_yValue(), 3));
@ -698,8 +699,7 @@ public class Sample_G_Analysis {
String nuclideName = entry.getKey();
GStoreMiddleProcessDataNuclLinesIded nuclLinesIded = entry.getValue();
GardsNuclLinesIded gardsNuclLinesIded = new GardsNuclLinesIded();
List<GardsNuclLinesIded> gardsNuclLinesIdeds =
mapFields(nuclLinesIded, gardsNuclLinesIded, base_IdPeak, fieldMap);
List<GardsNuclLinesIded> gardsNuclLinesIdeds = mapFields(nuclLinesIded, gardsNuclLinesIded, base_IdPeak, fieldMap);
if (CollUtil.isNotEmpty(gardsNuclLinesIdeds)){
for (GardsNuclLinesIded ided : gardsNuclLinesIdeds) {
ided.setSampleId(sampleId);
@ -765,22 +765,36 @@ public class Sample_G_Analysis {
public Map<String,String> fieldMap(){
Map<String,String> 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("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_Nucidename","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_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");

View File

@ -3476,8 +3476,8 @@ public class GammaFileUtil extends AbstractLogOrReport {
middleData.peaks_Nuclide_name = dvctNuclide_name;
}
// gards_ nucl_lines_ided数据表
GStoreMiddleProcessDataNuclLinesIded nucl_lines_ided_data = new GStoreMiddleProcessDataNuclLinesIded();
for(Map.Entry<String, NuclideActMda> itor:fileAnlyse.getMapNucActMda().entrySet()) {
GStoreMiddleProcessDataNuclLinesIded nucl_lines_ided_data = new GStoreMiddleProcessDataNuclLinesIded();
List<String> svctNUCLIDEFULLNAME = new LinkedList<>();
List<String> dvctIDPEAK = new LinkedList<>();
List<Double> dvctENERGY = new LinkedList<>();

View File

@ -4,8 +4,10 @@ import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
import org.jeecg.modules.entity.vo.NuclideLine;
public interface GardsNuclLinesLibMapper extends BaseMapper<GardsNuclLinesLib> {
List<NuclideLine> getNuclideLines(@Param(value = "name") String name);
}

View File

@ -2,4 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.GardsNuclLinesLibMapper">
<select id="getNuclideLines" resultType="org.jeecg.modules.entity.vo.NuclideLine">
SELECT FULLNAME as fullName,
ENERGY as energy,
ENERGY_UNCERT as energyUncert,
YIELD as yield,
YIELD_UNCERT as yieldUncert,
KEY_FLAG as keyFlag
from CONFIGURATION.GARDS_NUCL_LINES_LIB WHERE NAME = #{name} ORDER BY ENERGY
</select>
</mapper>

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
import org.jeecg.modules.entity.vo.NuclideLines;
import java.util.List;
import java.util.Map;
@ -21,7 +22,7 @@ public interface ISysDefaultNuclideService extends IService<SysDefaultNuclide> {
Result<?> add(List<String> nuclideNames,String nuclideType,Integer useType);
Map<String,List<GardsNuclLinesLib>> mapLines(String nuclideType);
Map<String, NuclideLines> mapLines(String nuclideType);
void mapLines2Redis();
}

View File

@ -7,6 +7,8 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
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.GardsNuclLinesLibMapper;
import org.jeecg.modules.service.IGardsNuclLibService;
@ -16,9 +18,7 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
@ -60,41 +60,37 @@ public class GardsNuclLinesLibServiceImpl extends ServiceImpl<GardsNuclLinesLibM
result = allNuclide.stream().collect(Collectors.groupingBy(GardsNuclLinesLib::getName));
return result;
}
@Override
public Map<String, NuclideLines> defaultLines(List<String> nuclideNames) {
Map<String, NuclideLines> result = new HashMap<>();
LambdaQueryWrapper<GardsNuclLinesLib> wrapper = new LambdaQueryWrapper<>();
wrapper.in(GardsNuclLinesLib::getName, nuclideNames);
// 获取GardsNuclLinesLib核素数据
List<GardsNuclLinesLib> allNuclide = list(wrapper);
Map<String, Double> halfLife = nuclLibService.halfLife(nuclideNames);
// 按照 QT源代码 处理数据
for (int i = 0; i < allNuclide.size(); i++) {
NuclideLines nuclideLines;
GardsNuclLinesLib lib = allNuclide.get(i);
nuclideLines = result.containsKey(lib.getName()) ? result.get(lib.getName()) : new NuclideLines();
nuclideLines.getFullNames().add(lib.getFullName());
nuclideLines.getVenergy().add(lib.getEnergy());
nuclideLines.getVuncertE().add(lib.getEnergyUncert());
nuclideLines.getVyield().add(lib.getYield() / 100);
nuclideLines.getVuncertY().add(lib.getYieldUncert());
int keyFlag = lib.getKeyFlag();
if (keyFlag > 0){
int index = nuclideNames.indexOf(lib.getName());
nuclideLines.setKey_flag(index);
nuclideLines.setMaxYeildIdx(index);
}
String name = lib.getName();
Double day = halfLife.get(name);
if (ObjectUtil.isNotNull(day))
nuclideLines.setHalflife(day * 86400);
result.put(lib.getName(), nuclideLines);
Map<String, NuclideLines> mapLines = new HashMap<>();
if (nuclideNames.size() < 1) {
return mapLines;
}
return result;
Map<String, Double> halfLife = nuclLibService.halfLife(nuclideNames);
for (String name : nuclideNames) {
NuclideLines nlines = new NuclideLines();
List<NuclideLine> 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;
}
}
Double half = halfLife.get(name);
if (Objects.isNull(half)) {
half = 0.0;
} else {
half = half * 86400;
}
nlines.setHalflife(half);
mapLines.put(name, nlines);
}
return mapLines;
}
}

View File

@ -80,14 +80,14 @@ public class SysDefaultNuclideServiceImpl extends ServiceImpl<SysDefaultNuclideM
}
@Override
public Map<String,List<GardsNuclLinesLib>> mapLines(String nuclideType) {
public Map<String,NuclideLines> mapLines(String nuclideType) {
List<String> nuclideTypes = ListUtil.toList("G","P");
Map<String,List<GardsNuclLinesLib>> mapLines = MapUtil.newHashMap();
Map<String,NuclideLines> mapLines = MapUtil.newHashMap();
if (!nuclideTypes.contains(nuclideType))
return mapLines;
String key = RedisConstant.NUCLIDE_LINES_LIB + nuclideType;
if (redisUtil.hasKey(key))
return (Map<String,List<GardsNuclLinesLib>>)redisUtil.get(key);
return (Map<String,NuclideLines>)redisUtil.get(key);
LambdaQueryWrapper<SysDefaultNuclide> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysDefaultNuclide::getUseType,1);
wrapper.eq(SysDefaultNuclide::getNuclideType,nuclideType);
@ -96,7 +96,7 @@ public class SysDefaultNuclideServiceImpl extends ServiceImpl<SysDefaultNuclideM
.map(SysDefaultNuclide::getNuclideName)
.filter(StrUtil::isNotBlank)
.collect(Collectors.toList());
mapLines = nuclLinesLibService.mapLines(nuclideNames);
mapLines = nuclLinesLibService.defaultLines(nuclideNames);
redisUtil.set(key,mapLines);
return mapLines;
}