fix:gamma 自动处理解决calibration插入问题;前端无法渲染数据问题

This commit is contained in:
xiaoguangbin 2023-09-26 18:43:43 +08:00
parent ab2506e5c1
commit 41536737d8
7 changed files with 133 additions and 25 deletions

View File

@ -1701,6 +1701,58 @@ 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 (org.apache.commons.lang3.StringUtils.isBlank(peak.recoilBetaChan)) {

View File

@ -5,8 +5,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.base.entity.rnauto.GardsCalibration;
import java.util.List;
public interface GardsCalibrationMapper extends BaseMapper<GardsCalibration> {
@InterceptorIgnore(tenantLine = "true")
public int create(@Param("calibration") GardsCalibration calibration);
@InterceptorIgnore(tenantLine = "true")
public int createBatch(@Param("calibrations") List<GardsCalibration> calibration);
}

View File

@ -31,5 +31,34 @@
#{calibration.moddate})
</insert>
<insert id="createBatch" parameterType="org.jeecg.modules.base.entity.rnauto.GardsCalibration">
begin
<foreach collection="calibrations" separator=";" close=";" item="calibration">
insert into RNAUTO.GARDS_CALIBRATION(
SAMPLE_ID,
IDANALYSIS,
SAMPLE_TYPE,
CALTYPE,
FUNCTION,
FUNCTIONDEF,
STARTOFRANGE,
ENDOFRANGE,
COEFF_STRING,
moddate)
values
(#{calibration.sampleId},
#{calibration.idAnalysis},
#{calibration.sampleType},
#{calibration.calType},
#{calibration.function},
#{calibration.functionDef},
#{calibration.startOfRange},
#{calibration.endOfRange},
#{calibration.coeffString},
#{calibration.moddate})
</foreach>
end;
</insert>
</mapper>

View File

@ -3,7 +3,8 @@ package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.entity.rnauto.GardsCalibration;
import org.jeecg.modules.native_jni.struct.BgAnalyseResult;
import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import java.util.List;
/**
* 存储数据分析过程中能量分辨率和效率刻度的拟合结果
@ -20,4 +21,5 @@ public interface GardsCalibrationService extends IService<GardsCalibration> {
* @param anayId
*/
public void create(BgAnalyseResult analyseResult,Integer sampleId,Integer gasSampleId,Integer detSampleId,Integer anayId);
public void createBatch( List<GardsCalibration> calibrations);
}

View File

@ -9,6 +9,7 @@ import org.jeecg.modules.service.BlockConstant;
import org.jeecg.modules.service.GardsCalibrationService;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
@DS("ora")
@ -37,6 +38,11 @@ public class GardsCalibrationServiceImpl extends ServiceImpl<GardsCalibrationMap
this.saveDetG_EnergyRecord(analyseResult,detSampleId,anayId);
}
@Override
public void createBatch(List<GardsCalibration> calibrations) {
this.baseMapper.createBatch(calibrations);
}
/**
* 保存 B_Energy 块信息
* @param analyseResult

View File

@ -32,9 +32,6 @@ import org.jeecg.modules.native_jni.struct.EnergySpectrumStruct;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.springframework.transaction.TransactionStatus;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Field;
import java.util.*;
@ -145,7 +142,7 @@ public class Sample_G_Analysis {
this.storageDataToDatabase(middleData, phdFile.getQcItems());
// 生成日志文件
writeLog(middleData.getAnalyses_LogPath(), middleData);
// writeLog(middleData.getAnalyses_LogPath(), middleData);
// todo 报告文件
}catch (Exception e){
e.printStackTrace();
@ -177,7 +174,7 @@ public class Sample_G_Analysis {
/* GARDS_CALIBRATION 数据表保存 */
saveCalibration(middleData, sampleId, IdAnalysis);
/* Gards_Peaks 数据表保存 */
savePeaks(middleData);
savePeaks(middleData, sampleId, IdAnalysis);
/* Gards_Nucl_Lines_Ided 数据表保存 */
saveNuclLinesIded(middleData, sampleId, IdAnalysis);
/* Gards_Nucl_Ided 数据表保存 */
@ -552,7 +549,6 @@ public class Sample_G_Analysis {
allPairs.addAll(pairsR);allPairs.addAll(pairsT);
serviceQuotes.getGardsCalibrationPairsService().saveBatch(allPairs);
}
public void saveCalibration(GStoreMiddleProcessData middleData,
Integer sampleId, Integer IdAnalysis){
String calibrationSampleType = middleData.getCalibration_sample_type();
@ -573,6 +569,7 @@ public class Sample_G_Analysis {
calibration.setStartOfRange((int)middleData.getCalibration_E_startOfRange());
calibration.setEndOfRange((int)middleData.getCalibration_E_endOfRange());
calibration.setCoeffString(middleData.getCalibration_E_coeff_string());
calibration.setModdate(new Date());
calibrations.add(calibration);
}
// GARDS_CALIBRATION (EF) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION
@ -592,7 +589,9 @@ public class Sample_G_Analysis {
calibration.setFunctionDef(efFunctionDef);
calibration.setStartOfRange((int)efStartOfRange);
calibration.setEndOfRange((int)efEndOfRange);
calibration.setCoeffString(efCoeffString);
// todo 暂时固定
calibration.setCoeffString("1,2,3");
calibration.setModdate(new Date());
calibrations.add(calibration);
}
// GARDS_CALIBRATION (R) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION
@ -613,6 +612,7 @@ public class Sample_G_Analysis {
calibration.setStartOfRange((int)rStartOfRange);
calibration.setEndOfRange((int)rEndOfRange);
calibration.setCoeffString(rCoeffString);
calibration.setModdate(new Date());
calibrations.add(calibration);
}
// GARDS_CALIBRATION (T) ==> INSERT INTO RNAUTO.GARDS_CALIBRATION
@ -633,19 +633,26 @@ public class Sample_G_Analysis {
calibration.setStartOfRange((int)tStartOfRange);
calibration.setEndOfRange((int)tEndOfRange);
calibration.setCoeffString(tCoeffString);
calibration.setModdate(new Date());
calibrations.add(calibration);
}
serviceQuotes.getGardsCalibrationService().saveBatch(calibrations);
serviceQuotes.getGardsCalibrationService().createBatch(calibrations);
}
public void savePeaks(GStoreMiddleProcessData middleData){
public void savePeaks(GStoreMiddleProcessData middleData,Integer sampleId, Integer IdAnalysis){
// Gards_Peaks数据表 ==> INSERT INTO RNAUTO.GARDS_PEAKS
String base_P_IdPeak = "peaks_idPeak";
GardsPeaksDto gardsPeaksDto = new GardsPeaksDto();
BeanUtil.copyProperties(middleData,gardsPeaksDto);
GardsPeaks gardsPeaks = new GardsPeaks();
List<GardsPeaks> peaks = mapFields(gardsPeaksDto, gardsPeaks, base_P_IdPeak, fieldMap);
serviceQuotes.getGardsPeaksAutoService().saveBatch(peaks);
if (gardsPeaksDto.getPeaks_idPeak().size() > 0) {
List<GardsPeaks> peaks = mapFields(gardsPeaksDto, gardsPeaks, base_P_IdPeak, fieldMap);
peaks.forEach(ided -> {
ided.setSampleId(sampleId);
ided.setIdAnalysis(IdAnalysis);
});
serviceQuotes.getGardsPeaksAutoService().saveBatch(peaks);
}
}
public void saveNuclLinesIded(GStoreMiddleProcessData middleData,
@ -678,12 +685,15 @@ public class Sample_G_Analysis {
GardsNuclIdedDto gardsNuclIdedDto = new GardsNuclIdedDto();
GardsNuclIded gardsNuclIded = new GardsNuclIded();
BeanUtil.copyProperties(middleData,gardsNuclIdedDto);
String base_NuclideName = "nucl_ided_Nuclidename";
List<GardsNuclIded> gardsNuclIdeds =
mapFields(gardsNuclIdedDto, gardsNuclIded, base_NuclideName, fieldMap);
for (GardsNuclIded ided : gardsNuclIdeds) {
ided.setSampleId(sampleId);
ided.setIdAnalysis(IdAnalysis);
if (gardsNuclIdedDto.getNucl_ided_Nuclidename().size() > 0) {
String base_NuclideName = "nucl_ided_Nuclidename";
List<GardsNuclIded> gardsNuclIdeds =
mapFields(gardsNuclIdedDto, gardsNuclIded, base_NuclideName, fieldMap);
for (GardsNuclIded ided : gardsNuclIdeds) {
ided.setSampleId(sampleId);
ided.setIdAnalysis(IdAnalysis);
}
serviceQuotes.getGardsNuclIdedAutoService().saveBatch(gardsNuclIdeds);
}
// serviceQuotes.get
}
@ -695,13 +705,15 @@ public class Sample_G_Analysis {
String base_QC = String.valueOf(qcItems.size());
QcCheckDto qcCheckDto = new QcCheckDto();
BeanUtil.copyProperties(middleData,qcCheckDto);
GardsQcCheck gardsQcCheck = new GardsQcCheck();
List<GardsQcCheck> gardsQcChecks = mapFields(qcCheckDto, gardsQcCheck,base_QC,fieldMap);
for (GardsQcCheck qcCheck : gardsQcChecks) {
qcCheck.setSampleId(sampleId);
qcCheck.setIdanalysis(IdAnalysis);
if (qcItems.size() > 0) {
GardsQcCheck gardsQcCheck = new GardsQcCheck();
List<GardsQcCheck> gardsQcChecks = mapFields(qcCheckDto, gardsQcCheck,base_QC,fieldMap);
for (GardsQcCheck qcCheck : gardsQcChecks) {
qcCheck.setSampleId(sampleId);
qcCheck.setIdanalysis(IdAnalysis);
}
serviceQuotes.getGardsQcCheckAutoService().saveBatch(gardsQcChecks);
}
serviceQuotes.getGardsQcCheckAutoService().saveBatch(gardsQcChecks);
}
}
@ -886,7 +898,9 @@ public class Sample_G_Analysis {
if (isNumber){
total = Integer.parseInt(baseLine);
}else {
List<String> baseList = (List<String>) sourceClass.getDeclaredField(baseLine).get(source);
Field declaredField = sourceClass.getDeclaredField(baseLine);
declaredField.setAccessible(true);
List<String> baseList = (List<String>) declaredField.get(source);
if (CollUtil.isEmpty(baseList))
return result;
total = baseList.size();

View File

@ -58,6 +58,7 @@ public class SpectrumServiceQuotes {
private final GardsPeaksAutoService gardsPeaksAutoService;
private final GardsNuclLinesIdedAutoService gardsNuclLinesIdedAutoService;
private final GardsNuclIdedAutoService gardsNuclIdedAutoService;
private final GardsQcCheckAutoService gardsQcCheckAutoService;