算法所需实体类及调用方法提出到公用模块下
修改自动处理程序存储数据有误问题 新增ParameterProperties类 新增NumberFormatUtil工具类
This commit is contained in:
parent
386cec88c9
commit
d4d5653d02
|
@ -0,0 +1,24 @@
|
|||
package org.jeecg.common.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "parameter")
|
||||
public class ParameterProperties implements Serializable {
|
||||
|
||||
/**
|
||||
* 算法计算需要用到的文件存储路径
|
||||
*/
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* db文件存储路径
|
||||
*/
|
||||
private String dbPath;
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
|
||||
@Component
|
||||
public class NumberFormatUtil {
|
||||
|
||||
public static void main(String[] args) {
|
||||
double value = 8823 * 12 * 30 + 79.2 * 10000;
|
||||
value = value - 2640000;
|
||||
System.out.println(value);
|
||||
}
|
||||
|
||||
//接收参数判断是否是科学计数法
|
||||
public static String numberFormat(String number) {
|
||||
String value = "";
|
||||
//判断传入的字符串是否包含e
|
||||
if (StringUtils.isNotBlank(number)) {
|
||||
if (number.contains("e") || number.contains("E")) {
|
||||
value = scienceCal(number);
|
||||
} else {
|
||||
value = numberCal(number);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static String scienceCal(String number) {
|
||||
String value = "";
|
||||
if (number.indexOf("e")>0) {
|
||||
String calNumber = number.substring(0, number.indexOf("e"));
|
||||
String numberCal = numberCal(calNumber);
|
||||
value = numberCal + number.substring(number.indexOf("e"));
|
||||
} else if (number.indexOf("E")>0) {
|
||||
String calNumber = number.substring(0, number.indexOf("E"));
|
||||
String numberCal = numberCal(calNumber);
|
||||
value = numberCal + number.substring(number.indexOf("E"));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
//正常小数进行固定长度的保留小数
|
||||
public static String numberCal(String number) {
|
||||
//将当前字符串的数字
|
||||
BigDecimal b = new BigDecimal(number);
|
||||
BigDecimal divisor = BigDecimal.ONE;
|
||||
//需要保留的长度
|
||||
MathContext mc = new MathContext(6);
|
||||
return String.valueOf(b.divide(divisor, mc));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -12,26 +12,16 @@ public class AnalyseData implements Serializable {
|
|||
|
||||
private boolean sampleData;
|
||||
|
||||
private boolean GasBgData;
|
||||
private boolean gasBgData;
|
||||
|
||||
private boolean DetBgData;
|
||||
private boolean detBgData;
|
||||
|
||||
private boolean QCData;
|
||||
|
||||
private boolean gFitting;
|
||||
|
||||
private boolean bFitting;
|
||||
private boolean qcData;
|
||||
|
||||
private boolean bGammaEnergyValid;
|
||||
|
||||
private boolean bBetaEnergyValid;
|
||||
|
||||
private List<TableWidget> fittingChannelEnergy;
|
||||
|
||||
private CalibrationParam g_calibration_param;
|
||||
|
||||
private CalibrationParam b_calibration_param;
|
||||
|
||||
private List<String> dbNames;
|
||||
|
||||
private List<Integer> sampleIds;
|
||||
|
@ -42,15 +32,15 @@ public class AnalyseData implements Serializable {
|
|||
|
||||
private List<String> detFileNames;
|
||||
|
||||
private List<String> qcFileNames;
|
||||
|
||||
public AnalyseData(){
|
||||
sampleData = false;
|
||||
GasBgData = false;
|
||||
DetBgData = false;
|
||||
QCData = false;
|
||||
gasBgData = false;
|
||||
detBgData = false;
|
||||
qcData = false;
|
||||
bGammaEnergyValid = false;
|
||||
bBetaEnergyValid = false;
|
||||
g_calibration_param = new CalibrationParam();
|
||||
b_calibration_param = new CalibrationParam();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-module-BetaGammaAnalyser</artifactId>
|
||||
<artifactId>jeecg-module-beta-gamma-analyser</artifactId>
|
||||
</dependency>
|
||||
<!-- 引入jeecg-boot-starter-cloud依赖 -->
|
||||
<dependency>
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.*;
|
||||
import org.jeecg.common.constant.enums.SpectrumSystemType;
|
||||
import org.jeecg.common.properties.ParameterProperties;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.util.GammaFileUtil;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
|
@ -30,6 +31,7 @@ import org.jeecg.modules.entity.vo.*;
|
|||
import org.jeecg.modules.ftp.FTPUtils;
|
||||
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -56,6 +58,8 @@ public class Sample_G_Analysis {
|
|||
// 能谱文件存储路径属性
|
||||
private SpectrumPathProperties spectrumPathProperties;
|
||||
|
||||
private ParameterProperties parameterProperties;
|
||||
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
/**
|
||||
|
@ -117,8 +121,9 @@ public class Sample_G_Analysis {
|
|||
Integer sampleId = sampleData.getSampleId();
|
||||
|
||||
GammaFileUtil gammaFileUtil = ApplicationContextUtil.getContext().getBean(GammaFileUtil.class);
|
||||
parameterProperties = ApplicationContextUtil.getContext().getBean(ParameterProperties.class);
|
||||
PHDFile phdFile = new PHDFile();
|
||||
|
||||
phdFile.setXmlFilePath(parameterProperties.getFilePath());
|
||||
// 解析PHD文件
|
||||
spectrumPathProperties = ApplicationContextUtil.getContext().getBean(SpectrumPathProperties.class);
|
||||
String sampleFilePath = sampleData.getInputFileName();
|
||||
|
@ -126,7 +131,7 @@ public class Sample_G_Analysis {
|
|||
String fileName = sampleFilePath.substring(sampleFilePath.lastIndexOf(StringPool.SLASH)+1);
|
||||
boolean flag = gammaFileUtil.loadFile(pathName, fileName, phdFile, new Result());
|
||||
// todo 测试阶段暂时注释掉,获取数据库 Gamma 默认参数
|
||||
// getSettingFromDB(phdFile);
|
||||
getSettingFromDB(phdFile);
|
||||
// 文件路径
|
||||
middleData.setAnalyses_save_filePath(this.sampleInputFilename);
|
||||
// 读取文件内容并附值
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.spectrum;
|
|||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jeecg.common.properties.ParameterProperties;
|
||||
import org.jeecg.common.properties.SoftwareProperties;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.properties.TaskProperties;
|
||||
|
@ -36,6 +37,8 @@ public class SpectrumServiceQuotes {
|
|||
|
||||
private final SpectrumPathProperties spectrumPathProperties;
|
||||
|
||||
private final ParameterProperties parameterProperties;
|
||||
|
||||
private final ISOHSpectrumService sohSpectrumService;
|
||||
|
||||
private final IAlertSpectrumService alertSpectrumService;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<version>3.5.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>jeecg-module-BetaGammaAnalyser</artifactId>
|
||||
<artifactId>jeecg-module-beta-gamma-analyser</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
|
@ -11,6 +11,7 @@ import org.apache.commons.net.ftp.FTP;
|
|||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.ejml.simple.SimpleMatrix;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.properties.ParameterProperties;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
|
||||
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
|
||||
|
@ -44,8 +45,8 @@ import java.util.*;
|
|||
@Component
|
||||
public class GammaFileUtil {
|
||||
|
||||
@Value("${parameter.filePath}")
|
||||
private String parameterFilePath;
|
||||
@Autowired
|
||||
private ParameterProperties parameterProperties;
|
||||
@Autowired
|
||||
private FTPUtil ftpUtil;
|
||||
@Autowired
|
||||
|
@ -845,7 +846,7 @@ public class GammaFileUtil {
|
|||
|
||||
public boolean ReadQCLimit(Map<String, QcCheckItem> qcItems, Map<String, Double> vMdcInfoMap, Double ener_Be7, String systemType) {
|
||||
try {
|
||||
String filePath = parameterFilePath+ File.separator +"SystemManager.xml";
|
||||
String filePath = parameterProperties.getFilePath()+ File.separator +"SystemManager.xml";
|
||||
//创建一个文档解析器工厂
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
//创建文档解析器
|
||||
|
@ -1383,7 +1384,6 @@ public class GammaFileUtil {
|
|||
String strValue = CalValuesHandler.analyseSpectrum(phdStr, nuclideLinesMap, tmpFile.getAbsolutePath());
|
||||
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
|
||||
for (Map.Entry<String, Object> entry:parseMap.entrySet()) {
|
||||
System.out.println(entry.getKey());
|
||||
if (entry.getKey().equalsIgnoreCase("bAnalyed")) {
|
||||
boolean value = JSON.parseObject(JSON.toJSONString(entry.getValue()), Boolean.class);
|
||||
phd.setBAnalyed(value);
|
||||
|
@ -1546,58 +1546,6 @@ public class GammaFileUtil {
|
|||
}
|
||||
}
|
||||
BeanUtils.copyProperties(phd.getSetting(), phd.getUsedSetting());
|
||||
if(CollectionUtils.isNotEmpty(phd.getMapEnerKD())) {
|
||||
String key = "";
|
||||
key = phd.getNewEner();
|
||||
phd.setUsedEner(key);
|
||||
GEnergyBlock source = new GEnergyBlock();
|
||||
GEnergyBlock gEnergyBlock = phd.getMapEnerKD().get(phd.getNewEner());
|
||||
BeanUtils.copyProperties(gEnergyBlock, source);
|
||||
phd.setUsedEnerKD(source);
|
||||
ParameterInfo info = new ParameterInfo();
|
||||
ParameterInfo parameterInfo = phd.getMapEnerPara().get(phd.getNewEner());
|
||||
BeanUtils.copyProperties(parameterInfo, info);
|
||||
phd.setUsedEnerPara(info);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(phd.getMapResoKD())) {
|
||||
String key = "";
|
||||
key = phd.getNewReso();
|
||||
phd.setUsedReso(key);
|
||||
GResolutionBlock source = new GResolutionBlock();
|
||||
GResolutionBlock gResolutionBlock = phd.getMapResoKD().get(phd.getNewReso());
|
||||
BeanUtils.copyProperties(gResolutionBlock, source);
|
||||
phd.setUsedResoKD(source);
|
||||
ParameterInfo info = new ParameterInfo();
|
||||
ParameterInfo parameterInfo = phd.getMapResoPara().get(phd.getNewReso());
|
||||
BeanUtils.copyProperties(parameterInfo, info);
|
||||
phd.setUsedResoPara(info);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(phd.getMapEffiKD())) {
|
||||
String key = "";
|
||||
key = phd.getNewEffi();
|
||||
phd.setUsedEffi(key);
|
||||
GEfficiencyBlock source = new GEfficiencyBlock();
|
||||
GEfficiencyBlock gEfficiencyBlock = phd.getMapEffiKD().get(phd.getNewEffi());
|
||||
BeanUtils.copyProperties(gEfficiencyBlock, source);
|
||||
phd.setUsedEffiKD(source);
|
||||
ParameterInfo info = new ParameterInfo();
|
||||
ParameterInfo parameterInfo = Objects.nonNull(phd.getMapEffiPara().get(phd.getNewEffi()))?phd.getMapEffiPara().get(phd.getNewEffi()):new ParameterInfo();
|
||||
BeanUtils.copyProperties(parameterInfo, info);
|
||||
phd.setUsedEffiPara(info);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(phd.getMapTotEKD())) {
|
||||
String key = "";
|
||||
key = phd.getNewTotE();
|
||||
phd.setUsedTotE(key);
|
||||
TotaleffBlock source = new TotaleffBlock();
|
||||
TotaleffBlock totaleffBlock = phd.getMapTotEKD().get(phd.getNewTotE());
|
||||
BeanUtils.copyProperties(totaleffBlock, source);
|
||||
phd.setUsedTotEKD(source);
|
||||
ParameterInfo info = new ParameterInfo();
|
||||
ParameterInfo parameterInfo = Objects.nonNull(phd.getMapTotEPara().get(phd.getNewTotE()))?phd.getMapTotEPara().get(phd.getNewTotE()):new ParameterInfo();
|
||||
BeanUtils.copyProperties(parameterInfo, info);
|
||||
phd.setUsedTotEPara(info);
|
||||
}
|
||||
|
||||
for (PeakInfo peak:phd.getVPeak()) {
|
||||
if (StringUtils.isBlank(peak.recoilBetaChan)) {
|
||||
|
@ -1810,7 +1758,7 @@ public class GammaFileUtil {
|
|||
|
||||
private void ReadSpecialNuclides(Map<String, Double> mapHalflife, List<String> vNuclides) {
|
||||
try {
|
||||
String fileName = parameterFilePath+"/setup/nuclide_ActMdc.txt";
|
||||
String fileName = parameterProperties.getFilePath() + StringPool.SLASH +"nuclide_ActMdc.txt";
|
||||
File t_file = new File(fileName);
|
||||
List<String> readLines = FileUtils.readLines(t_file, "UTF-8");
|
||||
for (int i=0;i< readLines.size();i++){
|
||||
|
@ -2061,7 +2009,7 @@ public class GammaFileUtil {
|
|||
|
||||
public void ReadData(List<Double> m_vEnergy, List<String> m_vNuclide) {
|
||||
try {
|
||||
String filePath = parameterFilePath+File.separator+"Energy_Nuclide.txt";
|
||||
String filePath = parameterProperties.getFilePath() +File.separator+"Energy_Nuclide.txt";
|
||||
File file = new File(filePath);
|
||||
List<String> readLines = FileUtils.readLines(file, "UTF-8");
|
||||
for (int i=0; i<readLines.size(); i++){
|
||||
|
@ -2226,12 +2174,14 @@ public class GammaFileUtil {
|
|||
map.put("AllData", datalist);
|
||||
}
|
||||
|
||||
public String UpdateEquationEfficiency(List<Double> m_vCurEnergy, ParameterInfo m_curParam) {
|
||||
public String UpdateEquationEfficiency(List<Double> m_vCurEnergy, ParameterInfo m_curParam, Integer funId) {
|
||||
String equation = "";
|
||||
if(m_curParam.getP().size() > 2) {
|
||||
int p_size = m_curParam.getP().size()-1;
|
||||
int e_size = m_vCurEnergy.size();
|
||||
int funId = m_curParam.getP().get(0).intValue();
|
||||
if (Objects.isNull(funId)) {
|
||||
funId = m_curParam.getP().get(0).intValue();
|
||||
}
|
||||
switch(funId) {
|
||||
case 1: // Interpolation: y=yi+(y(i+1)-yi)*(x-xi)/(x(i+1)-xi) for xi<=x<x(i+1)
|
||||
if(p_size == 2 * e_size && p_size >= 4) {
|
||||
|
@ -2698,7 +2648,11 @@ public class GammaFileUtil {
|
|||
public List<String> DoubleLimit(List data) {
|
||||
List<String> rData = new LinkedList<>();
|
||||
for(int pos=0;pos<data.size();pos++) {
|
||||
rData.add(String.format("%.3f", Double.valueOf(String.valueOf(data.get(pos)))));
|
||||
if (null != data.get(pos)) {
|
||||
rData.add(String.valueOf(data.get(pos)));
|
||||
} else {
|
||||
rData.add(null);
|
||||
}
|
||||
}
|
||||
return rData;
|
||||
}
|
||||
|
@ -2708,7 +2662,7 @@ public class GammaFileUtil {
|
|||
for(int pos=0;pos<_data.size();pos++) {
|
||||
Double value = _data.get(pos);
|
||||
if(Objects.isNull(value)) {
|
||||
rdata.add("NULL");
|
||||
rdata.add(null);
|
||||
} else {
|
||||
rdata.add(String.format("%.10g", value));
|
||||
}
|
||||
|
@ -3005,7 +2959,7 @@ public class GammaFileUtil {
|
|||
}
|
||||
funcDefEffi = EquationDescription(funcType);
|
||||
funcTypeDefEffi = EquationName(funcType);
|
||||
middleData.calibration_EF_Caltype = "efficiency";
|
||||
middleData.calibration_EF_Caltype = CalType.EFFICIENCY_CAL.getType();
|
||||
middleData.calibration_EF_function = funcType;
|
||||
middleData.calibration_EF_functionDef = funcDefEffi;
|
||||
middleData.calibration_EF_functionTypeDef = funcTypeDefEffi;
|
||||
|
@ -3037,7 +2991,7 @@ public class GammaFileUtil {
|
|||
}
|
||||
funcDefReso = EquationDescription(funcType);
|
||||
funcTypeDefReso = EquationName(funcType);
|
||||
middleData.calibration_R_Caltype = "Resolution";
|
||||
middleData.calibration_R_Caltype = CalType.RESOLUTION_CAL.getType();
|
||||
middleData.calibration_R_function = funcType;
|
||||
middleData.calibration_R_functionDef = funcDefReso;
|
||||
middleData.calibration_R_functionTypeDef = funcTypeDefReso;
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-module-BetaGammaAnalyser</artifactId>
|
||||
<artifactId>jeecg-module-beta-gamma-analyser</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.ejml/ejml-simple -->
|
||||
|
|
|
@ -13,8 +13,6 @@ public class SpectrumGroup implements Serializable {
|
|||
public List<Double> b_c2e;
|
||||
public List<Double> g_c2e;
|
||||
|
||||
public Integer sampleId;
|
||||
|
||||
public SpectrumGroup(){
|
||||
BgCalPara = new BgCalibratePara();
|
||||
b_c2e = new LinkedList<>();
|
|
@ -1,5 +1,6 @@
|
|||
package org.jeecg.modules.native_jni;
|
||||
|
||||
import org.jeecg.modules.entity.vo.BgCalibratePara;
|
||||
import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
|
||||
import org.jeecg.modules.native_jni.struct.BgBoundary;
|
||||
import org.jeecg.modules.native_jni.struct.CalcBgBoundaryParam;
|
||||
|
@ -51,4 +52,14 @@ public class EnergySpectrumHandler {
|
|||
*/
|
||||
public static native BgAnalyseResult bgAnalyse(String sampleFile, String gasFile, String detFile);
|
||||
|
||||
/**
|
||||
* BetaGamma 重新分析算法
|
||||
* @param sampleFile
|
||||
* @param gasFile
|
||||
* @param detFile
|
||||
* @param BgCalPara
|
||||
* @return
|
||||
*/
|
||||
public static native BgAnalyseResult bgReAnalyse(String sampleFile, String gasFile, String detFile, BgCalibratePara BgCalPara);
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.apache.commons.net.ftp.FTPClient;
|
|||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.cache.LocalCache;
|
||||
import org.jeecg.common.constant.DateConstant;
|
||||
import org.jeecg.common.properties.ParameterProperties;
|
||||
import org.jeecg.common.properties.SpectrumPathProperties;
|
||||
import org.jeecg.common.system.util.JwtUtil;
|
||||
import org.jeecg.common.util.*;
|
||||
|
@ -39,6 +40,7 @@ import org.jeecg.modules.mapper.SpectrumAnalysisMapper;
|
|||
import org.jeecg.modules.native_jni.CalValuesHandler;
|
||||
import org.jeecg.modules.native_jni.struct.CalValuesOut;
|
||||
import org.jeecg.modules.service.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -89,8 +91,8 @@ public class GammaServiceImpl implements IGammaService {
|
|||
private FTPUtil ftpUtil;
|
||||
@Value("${ZeroTime}")
|
||||
private String ZeroTimeStr;
|
||||
@Value("${parameter.filePath}")
|
||||
private String parameterFilePath;
|
||||
@Autowired
|
||||
private ParameterProperties parameterProperties;
|
||||
@Autowired
|
||||
private IGardsAnalysesSpectrumService analysesSpectrumService;
|
||||
@Autowired
|
||||
|
@ -173,7 +175,16 @@ public class GammaServiceImpl implements IGammaService {
|
|||
@Override
|
||||
public Result testFun(String fileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
Cache<String, PHDFile> phdCache = localCache.getPHDCache();
|
||||
PHDFile phd = phdCache.getIfPresent(fileName);
|
||||
phd.getSetting().setBUpdateCal(false);
|
||||
phd.setUserId("1");
|
||||
phd.setXmlFilePath(parameterProperties.getFilePath());
|
||||
String systemType = fileName.substring(2, 3);
|
||||
if (Objects.isNull(phd)){
|
||||
result.error500("请先选择解析文件!");
|
||||
return result;
|
||||
}
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
//查询当前用户关联的核素信息
|
||||
List<String> nuclides = new LinkedList<>();
|
||||
|
@ -183,8 +194,197 @@ public class GammaServiceImpl implements IGammaService {
|
|||
nuclides = defaultNuclideSpectrumService.findNuclidesByUserName("admin", systemType);
|
||||
}
|
||||
Map<String, NuclideLines> nuclideLinesMap = GetNuclideLines(nuclides);
|
||||
//解析获取临时文件信息
|
||||
File tmpFile = gammaFileUtil.analyzeFile(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName, fileName);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
String phdStr = mapper.writeValueAsString(phd);
|
||||
String mapLines = mapper.writeValueAsString(nuclideLinesMap);
|
||||
String strValue = CalValuesHandler.analyseSpectrum(phdStr, mapLines, tmpFile.getAbsolutePath());
|
||||
Map<String, Object> parseMap = JSON.parseObject(strValue, Map.class);
|
||||
for (Map.Entry<String, Object> entry:parseMap.entrySet()) {
|
||||
if (entry.getKey().equalsIgnoreCase("bAnalyed")) {
|
||||
boolean value = JSON.parseObject(JSON.toJSONString(entry.getValue()), Boolean.class);
|
||||
phd.setBAnalyed(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("mapEnerPara")) {
|
||||
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
|
||||
Map<String, ParameterInfo> value = new HashMap<>();
|
||||
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
|
||||
String key = objectEntry.getKey();
|
||||
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
|
||||
value.put(key, entryValue);
|
||||
}
|
||||
phd.setMapEnerPara(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("mapResoPara")) {
|
||||
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
|
||||
Map<String, ParameterInfo> value = new HashMap<>();
|
||||
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
|
||||
String key = objectEntry.getKey();
|
||||
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
|
||||
value.put(key, entryValue);
|
||||
}
|
||||
phd.setMapResoPara(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("mapEffiPara")) {
|
||||
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
|
||||
Map<String, ParameterInfo> value = new HashMap<>();
|
||||
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
|
||||
String key = objectEntry.getKey();
|
||||
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
|
||||
value.put(key, entryValue);
|
||||
}
|
||||
phd.setMapEffiPara(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("mapTotEPara")) {
|
||||
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
|
||||
Map<String, ParameterInfo> value = new HashMap<>();
|
||||
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
|
||||
String key = objectEntry.getKey();
|
||||
ParameterInfo entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), ParameterInfo.class);
|
||||
value.put(key, entryValue);
|
||||
}
|
||||
phd.setMapTotEPara(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("para_stepRatio")) {
|
||||
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
|
||||
phd.setPara_stepRatio(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("para_tail")) {
|
||||
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
|
||||
phd.setPara_tail(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("para_tailAlpha")) {
|
||||
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
|
||||
phd.setPara_tailAlpha(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("para_tailRight")) {
|
||||
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
|
||||
phd.setPara_tailRight(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("para_tailRightAlpha")) {
|
||||
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
|
||||
phd.setPara_tailRightAlpha(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("newEner")) {
|
||||
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
|
||||
phd.setNewEner(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("mapEnerKD")) {
|
||||
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
|
||||
Map<String, GEnergyBlock> value = new HashMap<>();
|
||||
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
|
||||
String key = objectEntry.getKey();
|
||||
GEnergyBlock entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), GEnergyBlock.class);
|
||||
value.put(key, entryValue);
|
||||
}
|
||||
phd.setMapEnerKD(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("mapResoKD")) {
|
||||
HashMap<String, Object> jsonMap = JSON.parseObject(JSON.toJSONString(entry.getValue()), HashMap.class);
|
||||
Map<String, GResolutionBlock> value = new HashMap<>();
|
||||
for (Map.Entry<String, Object> objectEntry:jsonMap.entrySet()) {
|
||||
String key = objectEntry.getKey();
|
||||
GResolutionBlock entryValue = JSON.parseObject(JSON.toJSONString(objectEntry.getValue()), GResolutionBlock.class);
|
||||
value.put(key, entryValue);
|
||||
}
|
||||
phd.setMapResoKD(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("vEnergy")) {
|
||||
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
|
||||
phd.setVEnergy(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("vBase")) {
|
||||
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
|
||||
phd.setVBase(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("vLc")) {
|
||||
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
|
||||
phd.setVLc(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("vScac")) {
|
||||
List<Double> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), Double.class);
|
||||
phd.setVScac(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("vPeak")) {
|
||||
List<PeakInfo> value = JSON.parseArray(JSON.toJSONString(entry.getValue()), PeakInfo.class);
|
||||
phd.setVPeak(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("baseCtrls")) {
|
||||
BaseControls value = JSON.parseObject(JSON.toJSONString(entry.getValue()), BaseControls.class);
|
||||
phd.setBaseCtrls(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedEner")) {
|
||||
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
|
||||
phd.setUsedEner(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedEnerKD")) {
|
||||
GEnergyBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GEnergyBlock.class);
|
||||
phd.setUsedEnerKD(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedEnerPara")) {
|
||||
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
|
||||
phd.setUsedEnerPara(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedReso")) {
|
||||
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
|
||||
phd.setUsedReso(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedResoKD")) {
|
||||
GResolutionBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GResolutionBlock.class);
|
||||
phd.setUsedResoKD(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedResoPara")) {
|
||||
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
|
||||
phd.setUsedResoPara(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedEffi")) {
|
||||
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
|
||||
phd.setUsedEffi(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedEffiKD")) {
|
||||
GEfficiencyBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), GEfficiencyBlock.class);
|
||||
phd.setUsedEffiKD(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedEffiPara")) {
|
||||
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
|
||||
phd.setUsedEffiPara(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedTotE")) {
|
||||
String value = JSON.parseObject(JSON.toJSONString(entry.getValue()), String.class);
|
||||
phd.setUsedTotE(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedTotEKD")) {
|
||||
TotaleffBlock value = JSON.parseObject(JSON.toJSONString(entry.getValue()), TotaleffBlock.class);
|
||||
phd.setUsedTotEKD(value);
|
||||
}
|
||||
if (entry.getKey().equalsIgnoreCase("usedTotEPara")) {
|
||||
ParameterInfo value = JSON.parseObject(JSON.toJSONString(entry.getValue()), ParameterInfo.class);
|
||||
phd.setUsedTotEPara(value);
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(phd.getSetting(), phd.getUsedSetting());
|
||||
|
||||
for (PeakInfo peak:phd.getVPeak()) {
|
||||
if (StringUtils.isBlank(peak.recoilBetaChan)) {
|
||||
peak.recoilBetaChan = "1";
|
||||
}
|
||||
if (StringUtils.isBlank(peak.recoilDeltaChan)) {
|
||||
peak.recoilDeltaChan = "1";
|
||||
}
|
||||
}
|
||||
gammaFileUtil.NuclidesIdent(phd, nuclideLinesMap);
|
||||
gammaFileUtil.RunQC(phd);
|
||||
result.setResult(phd);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
if (Objects.nonNull(tmpFile)) {
|
||||
tmpFile.delete();
|
||||
}
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setResult(nuclideLinesMap);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -461,8 +661,8 @@ public class GammaServiceImpl implements IGammaService {
|
|||
phd.getMapNucActMda().get(str_key).setEfficiency(nuclLinesIdedSpectrum.getEffic());
|
||||
phd.getMapNucActMda().get(str_key).setEffi_err(nuclLinesIdedSpectrum.getUnEffic());
|
||||
phd.getMapNucActMda().get(str_key).setMda(nuclLinesIdedSpectrum.getMda());
|
||||
phd.getMapNucActMda().get(str_key).setMdc(Double.valueOf(nuclLinesIdedSpectrum.getMdc()));
|
||||
phd.getMapNucActMda().get(str_key).setConcentration(Double.valueOf(nuclLinesIdedSpectrum.getConcentration()));
|
||||
phd.getMapNucActMda().get(str_key).setMdc(nuclLinesIdedSpectrum.getMdc().equalsIgnoreCase("inf")?0.0:Double.valueOf(nuclLinesIdedSpectrum.getMdc()));
|
||||
phd.getMapNucActMda().get(str_key).setConcentration(nuclLinesIdedSpectrum.getConcentration().equalsIgnoreCase("inf")?0.0:Double.valueOf(nuclLinesIdedSpectrum.getConcentration()));
|
||||
if(phd.getMapNucActMda().get(str_key).getActivity() > 0){
|
||||
phd.getMapNucActMda().get(str_key).setBCalculateMDA(true);
|
||||
}
|
||||
|
@ -729,7 +929,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
phd.setUserId(user.getId());
|
||||
}
|
||||
//赋值xml文件存放路径
|
||||
phd.setXmlFilePath(parameterFilePath);
|
||||
phd.setXmlFilePath(parameterProperties.getFilePath());
|
||||
//获取当前角色的颜色配置
|
||||
Map<String, String> colorMap = sysUserColorService.initColor(userName);
|
||||
//查询当前用户关联的核素信息
|
||||
|
@ -2312,7 +2512,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
efficiencyDataList.add(efficiencyData);
|
||||
}
|
||||
map.put("table", efficiencyDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam);
|
||||
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam, null);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartEfficiency(m_vCurEnergy, m_curParam, m_vCurEffi, phd, width, map);
|
||||
map.put("ECutAnalysis_Low", phd.getSetting().getECutAnalysis_Low());
|
||||
|
@ -2370,7 +2570,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
String Warning = "Fit failed. Maybe:\n1. data's number are too little;\n2. %1 isn't suitable for the data.";
|
||||
}
|
||||
map.put("table", efficiencyDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam);
|
||||
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam, funcId);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartEfficiency(m_vCurEnergy, m_curParam, m_vCurEffi, phd, width, map);
|
||||
}
|
||||
|
@ -2505,7 +2705,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
efficiencyDataList.add(efficiencyData);
|
||||
}
|
||||
map.put("table", efficiencyDataList);
|
||||
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam);
|
||||
String equation = gammaFileUtil.UpdateEquationEfficiency(m_vCurEnergy, m_curParam, null);
|
||||
map.put("equation", equation);
|
||||
gammaFileUtil.UpdateChartEfficiency(m_vCurEnergy, m_curParam, m_vCurEffi, phd, width, map);
|
||||
map.put("ECutAnalysis_Low", phd.getSetting().getECutAnalysis_Low());
|
||||
|
@ -3141,7 +3341,7 @@ public class GammaServiceImpl implements IGammaService {
|
|||
}
|
||||
item.setName(name);
|
||||
item.setFlag(iter.getValue().isBPass() ? "PASS" : "FAIL");
|
||||
item.setValue(NumUtil.fixedMax(6 ,iter.getValue().getValue()));
|
||||
item.setValue( Double.parseDouble(NumberFormatUtil.numberCal(String.valueOf(iter.getValue().getValue()))) );
|
||||
String standard="";
|
||||
List<String> strList = Arrays.asList(iter.getValue().getStandard().split(StringPool.COMMA));
|
||||
for (String str : strList) {
|
||||
|
@ -3258,16 +3458,16 @@ public class GammaServiceImpl implements IGammaService {
|
|||
TablePeakFit tablePeak = new TablePeakFit();
|
||||
tablePeak.setIndex(i + 1);
|
||||
PeakInfo peak = phd.getVPeak().get(i);
|
||||
tablePeak.setEnergy(NumUtil.keep3Str(peak.energy));
|
||||
tablePeak.setEnergy( NumberFormatUtil.numberCal(String.valueOf(peak.energy)) );
|
||||
tablePeak.setEnergyErr(energy_uncert);
|
||||
tablePeak.setNetArea(NumUtil.keep4ScienceStr(peak.area));
|
||||
String area_err = peak.area > 0 ? NumUtil.keep2Str(peak.areaErr/peak.area*100) : "0";
|
||||
tablePeak.setNetArea( NumberFormatUtil.numberCal(String.valueOf(peak.area)) );
|
||||
String area_err = peak.area > 0 ? NumberFormatUtil.numberCal(String.valueOf(peak.areaErr/peak.area*100)) : "0";
|
||||
tablePeak.setAreaErr(area_err);
|
||||
String rate = live_time > 0 ? NumUtil.keep4ScienceStr(peak.area/live_time) : "0";
|
||||
String rate = live_time > 0 ? NumberFormatUtil.numberCal(String.valueOf(peak.area/live_time)) : "0";
|
||||
tablePeak.setNetCountRate(rate);
|
||||
tablePeak.setNcRateErr(area_err);
|
||||
tablePeak.setLc(NumUtil.keep4ScienceStr(peak.lc));
|
||||
tablePeak.setSignificance(NumUtil.keep2Str(peak.significance));
|
||||
tablePeak.setLc( NumberFormatUtil.numberCal(String.valueOf(peak.lc)) );
|
||||
tablePeak.setSignificance( NumberFormatUtil.numberCal(String.valueOf(peak.significance)) );
|
||||
peakFitList.add(tablePeak);
|
||||
}
|
||||
map.put("peakFit", peakFitList);
|
||||
|
|
|
@ -385,7 +385,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
@Override
|
||||
public Result getFileSpectrumChart(String sampleFileName, String gasFileName, String detFileName, String qcFileName, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + JwtUtil.getUserNameByToken(request);
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
List<String> filePath = new LinkedList<>();
|
||||
Map<String, Object> sampleMap = new HashMap<>();
|
||||
|
@ -2362,30 +2363,49 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
|
||||
@Override
|
||||
public Result ReAnalyse(AnalyseData analyseData, HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
String userName = JwtUtil.getUserNameByToken(request);
|
||||
if ("CurrentSpectrum".equals(analyseData.getApplyType())) {
|
||||
List<Integer> sampleIds = analyseData.getSampleIds();
|
||||
if (CollectionUtils.isNotEmpty(sampleIds)){
|
||||
String dbName = analyseData.getDbNames().get(0);
|
||||
Integer sampleId = sampleIds.get(0);
|
||||
Integer analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
Integer analysisID = null;
|
||||
if (dbName.equalsIgnoreCase("auto")){
|
||||
dbName = "RNAUTO";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, "RNAUTO");
|
||||
}else if (dbName.equalsIgnoreCase("man")){
|
||||
dbName = "RNMAN";
|
||||
analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
}
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID);
|
||||
if (Objects.nonNull(dbSpectrumFilePath)) {
|
||||
BetaGammaAnalyzeCurrentProcess(analyseData, dbSpectrumFilePath, userName);
|
||||
BgAnalyseResult analyseResult = BetaGammaAnalyzeCurrentProcess(analyseData, dbSpectrumFilePath, userName);
|
||||
result.setSuccess(true);
|
||||
result.setResult(analyseResult);
|
||||
}
|
||||
} else {
|
||||
String path = StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName;
|
||||
SpectrumFileRecord dbSpectrumFilePath = new SpectrumFileRecord();
|
||||
dbSpectrumFilePath.setSampleFilePath(path);
|
||||
dbSpectrumFilePath.setGasBgFilePath(path);
|
||||
dbSpectrumFilePath.setDetBgFilePath(path);
|
||||
BgAnalyseResult analyseResult = BetaGammaAnalyzeCurrentProcess(analyseData, dbSpectrumFilePath, userName);
|
||||
result.setSuccess(true);
|
||||
result.setResult(analyseResult);
|
||||
}
|
||||
} else if ("AllSpectrum".equals(analyseData.getApplyType())) {
|
||||
Map<String, SpectrumFileRecord> m_loadData = new HashMap<>();
|
||||
for (int i=0; i<analyseData.getSampleIds().size(); i++) {
|
||||
Integer sampleId = analyseData.getSampleIds().get(i);
|
||||
String dbName = analyseData.getDbNames().get(i);
|
||||
Integer analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID);
|
||||
m_loadData.put(String.valueOf(sampleId), dbSpectrumFilePath);
|
||||
}
|
||||
BetaGammaAnalyzeAllProcess(m_loadData, analyseData);
|
||||
}
|
||||
|
||||
// else if ("AllSpectrum".equals(analyseData.getApplyType())) {
|
||||
// Map<String, SpectrumFileRecord> m_loadData = new HashMap<>();
|
||||
// for (int i=0; i<analyseData.getSampleIds().size(); i++) {
|
||||
// Integer sampleId = analyseData.getSampleIds().get(i);
|
||||
// String dbName = analyseData.getDbNames().get(i);
|
||||
// Integer analysisID = spectrumAnalysisMapper.getAnalysisID(dbName, sampleId, userName);
|
||||
// SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(dbName, sampleId,analysisID);
|
||||
// m_loadData.put(String.valueOf(sampleId), dbSpectrumFilePath);
|
||||
// }
|
||||
// BetaGammaAnalyzeAllProcess(m_loadData, analyseData);
|
||||
// }
|
||||
// if (analyseData.isBBetaEnergyValid()) {
|
||||
// ui->BetaOriginalChartView->SetFittingParam(fit_analy_param.b_calibration_param.param_a_c2e_new,
|
||||
// fit_analy_param.b_calibration_param.param_b_c2e_new,
|
||||
|
@ -2402,96 +2422,126 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
|
|||
// fit_analy_param.g_calibration_param.param_b_c2e_new,
|
||||
// fit_analy_param.g_calibration_param.param_c_c2e_new);
|
||||
// }
|
||||
|
||||
return null;
|
||||
return result;
|
||||
}
|
||||
|
||||
private void BetaGammaAnalyzeCurrentProcess(AnalyseData analyseData, SpectrumFileRecord dbSpectrumFilePath, String userName){
|
||||
private BgAnalyseResult BetaGammaAnalyzeCurrentProcess(AnalyseData analyseData, SpectrumFileRecord dbSpectrumFilePath, String userName){
|
||||
SpectrumGroup spectrum_group = new SpectrumGroup();
|
||||
spectrum_group.sampleId = dbSpectrumFilePath.getSampleId();
|
||||
spectrum_group.SampleSpectrumFile = dbSpectrumFilePath.getSampleFilePath();
|
||||
spectrum_group.GasBgSpectrumFile = dbSpectrumFilePath.getGasBgFilePath();
|
||||
spectrum_group.DetBgSpectrumFile = dbSpectrumFilePath.getDetBgFilePath();
|
||||
|
||||
String sampleFilePath = dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH));
|
||||
String sampleFileName = dbSpectrumFilePath.getSampleFilePath().substring(dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)+1);
|
||||
String gasFilePath = dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH));
|
||||
String gasFileName = dbSpectrumFilePath.getGasBgFilePath().substring(dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)+1);
|
||||
String detFilePath = dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH));
|
||||
String detFileName = dbSpectrumFilePath.getDetBgFilePath().substring(dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)+1);
|
||||
List<String> qcFileNames = analyseData.getQcFileNames();
|
||||
String qcFileName = qcFileNames.get(0);
|
||||
//从本地缓存获取beta gamma的数组
|
||||
Cache<String, Map<String, Object>> cache = betaCache.getBetaCache();
|
||||
//根据qc文件名称-用户名-beta的方式获取beta的内容
|
||||
Map<String, Object> betaMap = cache.getIfPresent(qcFileName + "-" + userName + "-beta");
|
||||
List<SeriseData> betaList = new LinkedList<>();
|
||||
List<String> betaFittingPara = new LinkedList<>();
|
||||
List<String> betaFittingParaToUi = new LinkedList<>();
|
||||
if (CollectionUtils.isNotEmpty(betaMap)) {
|
||||
betaList = (List<SeriseData>)betaMap.get("Series");
|
||||
betaFittingPara = (List<String>) betaMap.get("fittingPara");
|
||||
betaFittingParaToUi = (List<String>) betaMap.get("fittingParaToUi");
|
||||
}
|
||||
//根据qc文件名称-用户名-gamma的方式获取gamma的内容
|
||||
Map<String, Object> gammaMap = cache.getIfPresent(qcFileName + "-" + userName + "-gamma");
|
||||
List<SeriseData> gammaList = new LinkedList<>();
|
||||
List<String> gammaFittingPara = new LinkedList<>();
|
||||
List<String> gammaFittingParaToUi = new LinkedList<>();
|
||||
if (CollectionUtils.isNotEmpty(gammaMap)) {
|
||||
gammaList = (List<SeriseData>)gammaMap.get("Series");
|
||||
gammaFittingPara = (List<String>) gammaMap.get("fittingPara");
|
||||
gammaFittingParaToUi = (List<String>) gammaMap.get("fittingParaToUi");
|
||||
}
|
||||
if (analyseData.isBBetaEnergyValid()) {
|
||||
List<Double> beCal = new LinkedList<>();
|
||||
beCal.add(analyseData.getB_calibration_param().param_c_e2c_new);
|
||||
beCal.add(analyseData.getB_calibration_param().param_b_e2c_new);
|
||||
beCal.add(analyseData.getB_calibration_param().param_a_e2c_new);
|
||||
beCal.add(Double.valueOf(betaFittingParaToUi.get(0)));
|
||||
beCal.add(Double.valueOf(betaFittingParaToUi.get(1)));
|
||||
beCal.add(Double.valueOf(betaFittingParaToUi.get(2)));
|
||||
spectrum_group.BgCalPara.b_e_cal = beCal;
|
||||
List<Double> bc2e = new LinkedList<>();
|
||||
bc2e.add(analyseData.getB_calibration_param().param_c_c2e_new);
|
||||
bc2e.add(analyseData.getB_calibration_param().param_b_c2e_new);
|
||||
bc2e.add(analyseData.getB_calibration_param().param_a_c2e_new);
|
||||
bc2e.add(Double.valueOf(betaFittingPara.get(0)));
|
||||
bc2e.add(Double.valueOf(betaFittingPara.get(1)));
|
||||
bc2e.add(Double.valueOf(betaFittingPara.get(2)));
|
||||
spectrum_group.b_c2e = bc2e;
|
||||
}
|
||||
if (analyseData.isBGammaEnergyValid()) {
|
||||
List<Double> geCal = new LinkedList<>();
|
||||
geCal.add(analyseData.getG_calibration_param().param_c_e2c_new);
|
||||
geCal.add(analyseData.getG_calibration_param().param_b_e2c_new);
|
||||
geCal.add(analyseData.getG_calibration_param().param_a_e2c_new);
|
||||
geCal.add(Double.valueOf(gammaFittingParaToUi.get(0)));
|
||||
geCal.add(Double.valueOf(gammaFittingParaToUi.get(1)));
|
||||
geCal.add(Double.valueOf(gammaFittingParaToUi.get(2)));
|
||||
spectrum_group.BgCalPara.g_e_cal = geCal;
|
||||
List<Double> gc2e = new LinkedList<>();
|
||||
gc2e.add(analyseData.getG_calibration_param().param_c_c2e_new);
|
||||
gc2e.add(analyseData.getG_calibration_param().param_b_c2e_new);
|
||||
gc2e.add(analyseData.getG_calibration_param().param_a_c2e_new);
|
||||
gc2e.add(Double.valueOf(gammaFittingPara.get(0)));
|
||||
gc2e.add(Double.valueOf(gammaFittingPara.get(1)));
|
||||
gc2e.add(Double.valueOf(gammaFittingPara.get(2)));
|
||||
spectrum_group.g_c2e = gc2e;
|
||||
}
|
||||
spectrum_group.BgCalPara.bApplyNewCalicSample = analyseData.isSampleData();
|
||||
spectrum_group.BgCalPara.bApplyNewCalicGasBg = analyseData.isGasBgData();
|
||||
spectrum_group.BgCalPara.bApplyNewCalicDetBg = analyseData.isDetBgData();
|
||||
spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQCData();
|
||||
|
||||
spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQcData();
|
||||
System.loadLibrary("ReadPHDFile");
|
||||
//根据文件路径 文件名称获取对应的临时文件
|
||||
File sampleTmp = phdFileUtil.analyzeFile(sampleFilePath, sampleFileName);
|
||||
File gasTmp = phdFileUtil.analyzeFile(gasFilePath, gasFileName);
|
||||
File detTmp = phdFileUtil.analyzeFile(detFilePath, detFileName);
|
||||
BgAnalyseResult analyseResult = EnergySpectrumHandler.bgReAnalyse(sampleTmp.getAbsolutePath(), gasTmp.getAbsolutePath(), detTmp.getAbsolutePath(), spectrum_group.BgCalPara);
|
||||
return analyseResult;
|
||||
}
|
||||
|
||||
private void BetaGammaAnalyzeAllProcess(Map<String, SpectrumFileRecord> m_loadData, AnalyseData analyseData){
|
||||
List<SpectrumGroup> spectrum_group_list = new LinkedList<>();
|
||||
for (Map.Entry<String, SpectrumFileRecord> entry: m_loadData.entrySet()){
|
||||
SpectrumGroup spectrum_group = new SpectrumGroup();
|
||||
SpectrumFileRecord spectrumFileRecord = entry.getValue();
|
||||
spectrum_group.SampleSpectrumFile = spectrumFileRecord.getSampleFilePath();
|
||||
spectrum_group.GasBgSpectrumFile = spectrumFileRecord.getGasBgFilePath();
|
||||
spectrum_group.DetBgSpectrumFile = spectrumFileRecord.getDetBgFilePath();
|
||||
|
||||
if (analyseData.isBBetaEnergyValid()) {
|
||||
List<Double> beCal = new LinkedList<>();
|
||||
beCal.add(analyseData.getB_calibration_param().param_c_e2c_new);
|
||||
beCal.add(analyseData.getB_calibration_param().param_b_e2c_new);
|
||||
beCal.add(analyseData.getB_calibration_param().param_a_e2c_new);
|
||||
spectrum_group.BgCalPara.b_e_cal = beCal;
|
||||
List<Double> bc2e = new LinkedList<>();
|
||||
bc2e.add(analyseData.getB_calibration_param().param_c_c2e_new);
|
||||
bc2e.add(analyseData.getB_calibration_param().param_b_c2e_new);
|
||||
bc2e.add(analyseData.getB_calibration_param().param_a_c2e_new);
|
||||
spectrum_group.b_c2e = bc2e;
|
||||
}
|
||||
if (analyseData.isBGammaEnergyValid()) {
|
||||
List<Double> geCal = new LinkedList<>();
|
||||
geCal.add(analyseData.getG_calibration_param().param_c_e2c_new);
|
||||
geCal.add(analyseData.getG_calibration_param().param_b_e2c_new);
|
||||
geCal.add(analyseData.getG_calibration_param().param_a_e2c_new);
|
||||
spectrum_group.BgCalPara.g_e_cal = geCal;
|
||||
List<Double> gc2e = new LinkedList<>();
|
||||
gc2e.add(analyseData.getG_calibration_param().param_c_c2e_new);
|
||||
gc2e.add(analyseData.getG_calibration_param().param_b_c2e_new);
|
||||
gc2e.add(analyseData.getG_calibration_param().param_a_c2e_new);
|
||||
spectrum_group.g_c2e = gc2e;
|
||||
}
|
||||
spectrum_group.BgCalPara.bApplyNewCalicSample = analyseData.isSampleData();
|
||||
spectrum_group.BgCalPara.bApplyNewCalicGasBg = analyseData.isGasBgData();
|
||||
spectrum_group.BgCalPara.bApplyNewCalicDetBg = analyseData.isDetBgData();
|
||||
spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQCData();
|
||||
|
||||
spectrum_group_list.add(spectrum_group);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(spectrum_group_list)) {
|
||||
// beta_gamma_analy.SetSpectrumGroupList(spectrum_group_list);
|
||||
// AnalyProcessDlg analy_dlg(beta_gamma_analy);
|
||||
// analy_dlg.SetProgressRange(0, spectrum_group_list.count());
|
||||
// analy_dlg.exec();
|
||||
}
|
||||
}
|
||||
// private void BetaGammaAnalyzeAllProcess(Map<String, SpectrumFileRecord> m_loadData, AnalyseData analyseData){
|
||||
// List<SpectrumGroup> spectrum_group_list = new LinkedList<>();
|
||||
// for (Map.Entry<String, SpectrumFileRecord> entry: m_loadData.entrySet()){
|
||||
// SpectrumGroup spectrum_group = new SpectrumGroup();
|
||||
// SpectrumFileRecord spectrumFileRecord = entry.getValue();
|
||||
// spectrum_group.SampleSpectrumFile = spectrumFileRecord.getSampleFilePath();
|
||||
// spectrum_group.GasBgSpectrumFile = spectrumFileRecord.getGasBgFilePath();
|
||||
// spectrum_group.DetBgSpectrumFile = spectrumFileRecord.getDetBgFilePath();
|
||||
//
|
||||
// if (analyseData.isBBetaEnergyValid()) {
|
||||
// List<Double> beCal = new LinkedList<>();
|
||||
// beCal.add(analyseData.getB_calibration_param().param_c_e2c_new);
|
||||
// beCal.add(analyseData.getB_calibration_param().param_b_e2c_new);
|
||||
// beCal.add(analyseData.getB_calibration_param().param_a_e2c_new);
|
||||
// spectrum_group.BgCalPara.b_e_cal = beCal;
|
||||
// List<Double> bc2e = new LinkedList<>();
|
||||
// bc2e.add(analyseData.getB_calibration_param().param_c_c2e_new);
|
||||
// bc2e.add(analyseData.getB_calibration_param().param_b_c2e_new);
|
||||
// bc2e.add(analyseData.getB_calibration_param().param_a_c2e_new);
|
||||
// spectrum_group.b_c2e = bc2e;
|
||||
// }
|
||||
// if (analyseData.isBGammaEnergyValid()) {
|
||||
// List<Double> geCal = new LinkedList<>();
|
||||
// geCal.add(analyseData.getG_calibration_param().param_c_e2c_new);
|
||||
// geCal.add(analyseData.getG_calibration_param().param_b_e2c_new);
|
||||
// geCal.add(analyseData.getG_calibration_param().param_a_e2c_new);
|
||||
// spectrum_group.BgCalPara.g_e_cal = geCal;
|
||||
// List<Double> gc2e = new LinkedList<>();
|
||||
// gc2e.add(analyseData.getG_calibration_param().param_c_c2e_new);
|
||||
// gc2e.add(analyseData.getG_calibration_param().param_b_c2e_new);
|
||||
// gc2e.add(analyseData.getG_calibration_param().param_a_c2e_new);
|
||||
// spectrum_group.g_c2e = gc2e;
|
||||
// }
|
||||
// spectrum_group.BgCalPara.bApplyNewCalicSample = analyseData.isSampleData();
|
||||
// spectrum_group.BgCalPara.bApplyNewCalicGasBg = analyseData.isGasBgData();
|
||||
// spectrum_group.BgCalPara.bApplyNewCalicDetBg = analyseData.isDetBgData();
|
||||
// spectrum_group.BgCalPara.bApplyNewCalicQc = analyseData.isQcData();
|
||||
//
|
||||
// spectrum_group_list.add(spectrum_group);
|
||||
// }
|
||||
//
|
||||
// if (CollectionUtils.isNotEmpty(spectrum_group_list)) {
|
||||
//// beta_gamma_analy.SetSpectrumGroupList(spectrum_group_list);
|
||||
//// AnalyProcessDlg analy_dlg(beta_gamma_analy);
|
||||
//// analy_dlg.SetProgressRange(0, spectrum_group_list.count());
|
||||
//// analy_dlg.exec();
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Result analyseCurrentSpectrum(String dbName, Integer sampleId, String sampleFileName, String gasFileName, String detFileName, HttpServletRequest request) {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package org.jeecg.common;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.properties.ParameterProperties;
|
||||
import org.jeecg.modules.entity.data.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.w3c.dom.*;
|
||||
|
@ -22,8 +24,8 @@ import java.util.concurrent.TimeUnit;
|
|||
@Component
|
||||
public class CalculateStationData {
|
||||
|
||||
@Value("${parameter.filePath}")
|
||||
private String parameterFilePath;
|
||||
@Autowired
|
||||
private ParameterProperties parameterProperties;
|
||||
|
||||
/**
|
||||
* 初始化配置信息
|
||||
|
@ -31,7 +33,7 @@ public class CalculateStationData {
|
|||
public RateParam initParameter() {
|
||||
try {
|
||||
//文件路径
|
||||
String filePath = parameterFilePath+ File.separator +"parameter.xml";
|
||||
String filePath = parameterProperties.getFilePath()+ File.separator +"parameter.xml";
|
||||
//声明一个实体类存储参数信息
|
||||
RateParam mRateParam = new RateParam();
|
||||
//创建一个文档解析器工厂
|
||||
|
|
|
@ -65,8 +65,8 @@ public class JeecgAutoProcessApplication extends SpringBootServletInitializer im
|
|||
if(EmailReceivePolicy.CURR_DATE_ORDER_RECEIVE.getPolicy().equals(taskProperties.getReceivePolicy())){
|
||||
systemStartupTime = new Date();
|
||||
}
|
||||
autoProcessManager.start(systemStartupTime);
|
||||
undealHandleManager.start();
|
||||
// autoProcessManager.start(systemStartupTime);
|
||||
// undealHandleManager.start();
|
||||
fileSourceHandleManager.start();
|
||||
}
|
||||
}
|
6
pom.xml
6
pom.xml
|
@ -84,7 +84,7 @@
|
|||
<module>jeecg-module-abnormal-alarm</module>
|
||||
<module>jeecg-module-auto-process</module>
|
||||
<module>jeecg-module-spectrum-analysis</module>
|
||||
<module>jeecg-module-BetaGammaAnalyser</module>
|
||||
<module>jeecg-module-beta-gamma-analyser</module>
|
||||
</modules>
|
||||
|
||||
<repositories>
|
||||
|
@ -202,10 +202,10 @@
|
|||
<artifactId>jeecg-module-spectrum-analysis</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>
|
||||
<!--jeecg-module-BetaGammaAnalyser-->
|
||||
<!--jeecg-module-beta-gamma-analyser-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-module-BetaGammaAnalyser</artifactId>
|
||||
<artifactId>jeecg-module-beta-gamma-analyser</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>
|
||||
<!-- jeecg tools -->
|
||||
|
|
Loading…
Reference in New Issue
Block a user