beta功能saveToDB修改

beta功能增加分析文件方法
gamma新增saveDataEnergy接口
This commit is contained in:
qiaoqinzheng 2023-09-15 10:12:37 +08:00
parent 78ce76d6c3
commit 6dde566838
10 changed files with 310 additions and 130 deletions

View File

@ -212,8 +212,8 @@ public class SpectrumAnalysesController {
}
@PostMapping("saveToDB")
public Result saveToDB(@RequestBody BgDataAnlyseResultIn anlyseResultIn) {
return spectrumAnalysisService.saveToDB(anlyseResultIn);
public Result saveToDB(@RequestBody BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request) {
return spectrumAnalysisService.saveToDB(anlyseResultIn, request);
}
}

View File

@ -32,6 +32,11 @@ public class BgDataAnlyseResultIn implements Serializable {
*/
private String stationName;
/**
* 加载数据库名称
*/
private String dbName;
/**
* sample文件路径
*/
@ -63,7 +68,7 @@ public class BgDataAnlyseResultIn implements Serializable {
private String detFileName;
/**
* qc文件名称
* qc文件路径
*/
private String qcFilePath;
@ -182,32 +187,32 @@ public class BgDataAnlyseResultIn implements Serializable {
private String param_b_c2e_b_det;
private String param_c_c2e_b_det;
private double MDC_Xe135; //MDC XE135
private double MDC_Xe131m; //MDC XE131m
private double MDC_Xe133m; //MDC XE133m
private double MDC_Xe133; //MDC XE133
private double mdc_Xe135; //MDC XE135
private double mdc_Xe131m; //MDC XE131m
private double mdc_Xe133m; //MDC XE133m
private double mdc_Xe133; //MDC XE133
private double Xe135_con; //135不浓度
private double Xe135_uncer; //135不确定度
private double Xe131m_con;
private double Xe131m_uncer;
private double Xe133m_con;
private double Xe133m_uncer;
private double Xe133_con;
private double Xe133_uncer;
private double xe135_con; //135不浓度
private double xe135_uncer; //135不确定度
private double xe131m_con;
private double xe131m_uncer;
private double xe133m_con;
private double xe133m_uncer;
private double xe133_con;
private double xe133_uncer;
private double LC_Xe135; //LC XE135
private double LC_Xe131m; //LC XE131m
private double LC_Xe133m; //LC XE133m
private double LC_Xe133; //LC XE133
private double lc_Xe135; //LC XE135
private double lc_Xe131m; //LC XE131m
private double lc_Xe133m; //LC XE133m
private double lc_Xe133; //LC XE133
private int Xe131mFlag;
private int xe131mFlag;
private int Xe133Flag;
private int xe133Flag;
private int Xe133mFlag;
private int xe133mFlag;
private int Xe135Flag;
private int xe135Flag;
List<GardsCalibrationSpectrum> gammaCalibrationSpectrumList;

View File

@ -0,0 +1,69 @@
package org.jeecg.modules.entity.vo;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
public class PeakInfo implements Serializable {
public int index; //峰序号
public int multiIndex; //重峰序号
public int left; //峰的左边界
public int right; //峰的右边界
public double peakCentroid; //峰拟合后加权峰中心道
public double energy;
public double fwhmc; //半高宽
public double fwhm; //以keV为单位的半高宽
public double area; //净面积
public double areaErr; //
public double efficiency;
public double lc;
public double ld;
public double meanBackCount;
public double backgroundArea;
public double significance;
public double sensitivity;
public double stepRatio;
public double tail;
public double tailAlpha;
public double upperTail;
public double upperTailAlpha;
public double BWWidthChan;
public String recoilBetaChan;
public String recoilDeltaChan;
public String comments;
public List<String> nuclides;
public PeakInfo(){
nuclides = new LinkedList<>();
comments = "";
}
}

View File

@ -9,8 +9,7 @@ import org.jeecg.modules.base.entity.configuration.GardsDetectors;
import org.jeecg.modules.base.entity.configuration.GardsNuclLib;
import org.jeecg.modules.base.entity.configuration.GardsNuclLinesLib;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.rnman.GardsAnalySetting;
import org.jeecg.modules.base.entity.rnman.GardsCalibrationPairs;
import org.jeecg.modules.base.entity.rnman.*;
import org.jeecg.modules.entity.*;
import org.jeecg.modules.entity.vo.*;
@ -136,23 +135,27 @@ public interface SpectrumAnalysisMapper {
void deleteCalibrationPairs(Integer idAnalysis);
@InterceptorIgnore(tenantLine = "true")
void insertCalibrationPairs(List<GardsCalibrationPairs> calibrationPairsList);
void insertCalibrationPairs(@Param(value = "calibrationPairs") GardsCalibrationPairs calibrationPairs);
void deleteCalibration(Integer idAnalysis);
void insertCalibration(List<GardsCalibrationSpectrum> calibrationList);
@InterceptorIgnore(tenantLine = "true")
void insertCalibration(@Param(value = "calibration") GardsCalibration calibration);
void deleteROIChannels(Integer idAnalysis);
void insertROIChannels(List<GardsROIChannelsSpectrum> roiChannelsList);
@InterceptorIgnore(tenantLine = "true")
void insertROIChannels(@Param(value = "roiChannels") GardsRoiChannels roiChannels);
void deleteXeResult(Integer idAnalysis);
void insertXeResult(List<GardsXeResultsSpectrum> xeResults);
@InterceptorIgnore(tenantLine = "true")
void insertXeResult(@Param(value = "xeResult") GardsXeResults xeResult);
void deleteROIResults(Integer idAnalysis);
void insertROIResults(List<GardsROIResultsSpectrum> roiResultsSpectrumList);
@InterceptorIgnore(tenantLine = "true")
void insertROIResults(@Param(value = "roiResultsSpectrum") GardsRoiResults roiResultsSpectrum);
String getIdAnalysisByIdAnalyst(@Param(value = "sampleId") String sampleId, @Param(value = "userName") String userName);
@ -166,4 +169,6 @@ public interface SpectrumAnalysisMapper {
void deleteAnalySetting(Integer idAnalysis);
Integer getSampleIdLikeFileName(@Param(value = "fileName") String fileName);
}

View File

@ -824,11 +824,10 @@
</delete>
<insert id="insertCalibrationPairs" parameterType="java.util.List">
INSERT INTO RNMAN.GARDS_CALIBRATION_PAIRS(SAMPLE_ID,IDANALYSIS,SAMPLE_TYPE,CALTYPE,INPUT,IDCALPOINT,XVALUE,YVALUE)
INSERT INTO
RNMAN.GARDS_CALIBRATION_PAIRS(SAMPLE_ID,IDANALYSIS,SAMPLE_TYPE,CALTYPE,INPUT,IDCALPOINT,XVALUE,YVALUE)
VALUES
<foreach collection="calibrationPairsList" item="calibrationPairs" separator=",">
(#{calibrationPairs.sampleId},#{calibrationPairs.idAnalysis},#{calibrationPairs.sampleType},#{calibrationPairs.caltype},#{calibrationPairs.input},#{calibrationPairs.idCalPoint},#{calibrationPairs.xValue},#{calibrationPairs.yValue})
</foreach>
</insert>
<delete id="deleteCalibration">
@ -849,19 +848,17 @@
COEFF1,
COEFF2,
COEFF3)
<foreach collection="calibrationList" item="calibration" open=" " close=" " separator=",">
VALUES(#{calibration.sampleId},
#{calibration.idAnalysis},
#{calibration.sampleType},
#{calibration.calType},
#{calibration.function},
#{calibration.functionDef},
#{calibration.startOfRange},
#{calibration.endOfRange},
#{calibration.coeff1},
#{calibration.coeff2},
#{calibration.coeff3})
</foreach>
VALUES(#{calibration.sampleId},
#{calibration.idAnalysis},
#{calibration.sampleType},
#{calibration.calType},
#{calibration.function},
#{calibration.functionDef},
#{calibration.startOfRange},
#{calibration.endOfRange},
#{calibration.coeff1},
#{calibration.coeff2},
#{calibration.coeff3})
</insert>
@ -879,15 +876,13 @@
B_CHAN_STOP,
G_CHAN_START,
G_CHAN_STOP)
<foreach collection="roiChannelsList" item="roiChannels" open=" " close=" " separator=",">
VALUES(#{roiChannels.sampleId},
#{roiChannels.idAnalysis},
#{roiChannels.roi},
#{roiChannels.bChanStart},
#{roiChannels.bChanStop},
#{roiChannels.gChanStart},
#{roiChannels.gChanStop})
</foreach>
VALUES(#{roiChannels.sampleId},
#{roiChannels.idAnalysis},
#{roiChannels.roi},
#{roiChannels.bChanStart},
#{roiChannels.bChanStop},
#{roiChannels.gChanStart},
#{roiChannels.gChanStop})
</insert>
<delete id="deleteXeResult">
@ -904,16 +899,14 @@
MDC,
LC,
NID_FLAG)
<foreach collection="xeResults" item="xeResult" open=" " close=" " separator=",">
VALUES(#{xeResult.sampleId},
#{xeResult.idAnalysis},
#{xeResult.nuclideName},
#{xeResult.conc},
#{xeResult.concErr},
#{xeResult.mdc},
#{xeResult.lc},
#{xeResult.nidFlag})
</foreach>
VALUES(#{xeResult.sampleId},
#{xeResult.idAnalysis},
#{xeResult.nuclideName},
#{xeResult.conc},
#{xeResult.concErr},
#{xeResult.mdc},
#{xeResult.lc},
#{xeResult.nidFlag})
</insert>
<delete id="deleteROIResults">
@ -937,23 +930,21 @@
CONC_ERR,
MDC,
NID_FLAG)
<foreach collection="roiResultsSpectrumList" item="roiResultsSpectrum" open=" " separator="," close=" ">
VALUES(#{roiResultsSpectrum.sampleId},
#{roiResultsSpectrum.idAnalysis},
#{roiResultsSpectrum.roi},
#{roiResultsSpectrum.lc},
#{roiResultsSpectrum.sGross},
#{roiResultsSpectrum.gGross},
#{roiResultsSpectrum.bGross},
#{roiResultsSpectrum.sNet},
#{roiResultsSpectrum.gNet},
#{roiResultsSpectrum.net},
#{roiResultsSpectrum.netErr},
#{roiResultsSpectrum.conc},
#{roiResultsSpectrum.concErr},
#{roiResultsSpectrum.mdc},
#{roiResultsSpectrum.nidFlag})
</foreach>
VALUES(#{roiResultsSpectrum.sampleId},
#{roiResultsSpectrum.idAnalysis},
#{roiResultsSpectrum.roi},
#{roiResultsSpectrum.lc},
#{roiResultsSpectrum.sGross},
#{roiResultsSpectrum.gGross},
#{roiResultsSpectrum.bGross},
#{roiResultsSpectrum.sNet},
#{roiResultsSpectrum.gNet},
#{roiResultsSpectrum.net},
#{roiResultsSpectrum.netErr},
#{roiResultsSpectrum.conc},
#{roiResultsSpectrum.concErr},
#{roiResultsSpectrum.mdc},
#{roiResultsSpectrum.nidFlag})
</insert>
<select id="getIdAnalysisByIdAnalyst" resultType="java.lang.String">
@ -980,4 +971,8 @@
DELETE FROM RNMAN.GARDS_ANALY_SETTING WHERE IDANALYSIS= #{idAnalysis}
</delete>
<select id="getSampleIdLikeFileName" resultType="java.lang.Integer">
select SAMPLE_ID from ORIGINAL.GARDS_SAMPLE_DATA WHERE INPUT_FILE_NAME LIKE CONCAT('%', #{fileName})
</select>
</mapper>

View File

@ -6,6 +6,7 @@ import org.jeecg.modules.entity.vo.StructInsertOutput;
import org.jeecg.modules.native_jni.struct.CalValuesOut;
import java.util.List;
import java.util.Map;
public class CalValuesHandler {
@ -25,4 +26,22 @@ public class CalValuesHandler {
public static native StructInsertOutput ComputePeakRange(int peakSize, int m_nCount, List<Double> vCentroid, List<Double> vFwhmCh, List<Double> vTail, List<Double> vUpperTail);
public static native List<Double> calValues(int cal, int m_nChans);
public static native List<Double> GetFwhmcAll(int m_nChans);
public static native List<Double> calculateLC(List<Double> BaseLine, List<Double> FwhmcAll, double RiskLevelK);
public static native List<Double> calculateSCAC(List<Double> Spectrum, List<Double> BaseLine, List<Double> FwhmcAll);
public static native boolean armaAny(List<Double> Spectrum);
public static native String calUpdate(String dataType, List<Double> certEne, boolean E1, boolean R, boolean E2, boolean KeepCalPeakSearchPeaks, double k_back, double k_alpha, double k_beta);
public static native String peakSearch(double ECutLow, double ECutHigh, double deltaE, double pssLow, double k_back, double k_alpha, double k_beta);
public static native String baseImprove(double BaseImprovePSS, double k_back, double k_alpha, double k_beta);
public static native String fitPeakFull();
}

View File

@ -3,8 +3,7 @@ package org.jeecg.modules.native_jni.struct;
import java.util.List;
public class BgAnalyseResult {
/************************** GARDS_XE_RESULTS START**************************/
/************************** GARDS_XE_RESULTS START**************************/
/************************** XE_131m **************************/
public double Xe131m_con;
public double Xe131m_uncer;
@ -47,34 +46,38 @@ public class BgAnalyseResult {
public List<Double> ROI_con_uncer_err;
public List<Double> MDC;
public List<Integer> dNidFlag;
public List<Double> LC_CTS;
/************************** GARDS_ROI_RESULTS end **************************/
/************************** GARDS_CALIBRATION START**************************/
public List<Double> s_b_fitting_c_e;
public List<Double> s_b_fitting_e_c;
public int s_b_fitting_type;
public String s_b_fitting_type_def;
public List<Double> s_g_fitting_c_e;
public List<Double> s_g_fitting_e_c;
public int s_g_fitting_type;
public String s_g_fitting_type_def;
public List<Double> g_b_fitting_c_e;
public List<Double> s_b_fitting_c_e;
public List<Double> s_g_fitting_c_e;
public List<Double> g_b_fitting_e_c;
public int g_b_fitting_type;
public String g_b_fitting_type_def;
public List<Double> g_g_fitting_c_e;
public List<Double> g_g_fitting_e_c;
public int g_g_fitting_type;
public String g_g_fitting_type_def;
public List<Double> d_b_fitting_c_e;
public List<Double> g_b_fitting_c_e;
public List<Double> g_g_fitting_c_e;
public List<Double> d_b_fitting_e_c;
public int d_b_fitting_type;
public String d_b_fitting_type_def;
public List<Double> d_g_fitting_c_e;
public List<Double> d_g_fitting_e_c;
public int d_g_fitting_type;
public String d_g_fitting_type_def;
public List<Double> d_b_fitting_c_e;
public List<Double> d_g_fitting_c_e;
/************************** GARDS_CALIBRATION end **************************/
/************************** GARDS_ROI_CHANNELS START**************************/
@ -141,24 +144,31 @@ public class BgAnalyseResult {
", ROI_con_uncer_err=" + ROI_con_uncer_err +
", MDC=" + MDC +
", dNidFlag=" + dNidFlag +
", LC_CTS=" + LC_CTS +
", s_b_fitting_e_c=" + s_b_fitting_e_c +
", s_b_fitting_type=" + s_b_fitting_type +
", s_b_fitting_type_def='" + s_b_fitting_type_def + '\'' +
", s_g_fitting_e_c=" + s_g_fitting_e_c +
", s_g_fitting_type=" + s_g_fitting_type +
", s_g_fitting_type_def='" + s_g_fitting_type_def + '\'' +
", s_b_fitting_c_e=" + s_b_fitting_c_e +
", s_g_fitting_c_e=" + s_g_fitting_c_e +
", g_b_fitting_e_c=" + g_b_fitting_e_c +
", g_b_fitting_type=" + g_b_fitting_type +
", g_b_fitting_type_def='" + g_b_fitting_type_def + '\'' +
", g_g_fitting_e_c=" + g_g_fitting_e_c +
", g_g_fitting_type=" + g_g_fitting_type +
", g_g_fitting_type_def='" + g_g_fitting_type_def + '\'' +
", g_b_fitting_c_e=" + g_b_fitting_c_e +
", g_g_fitting_c_e=" + g_g_fitting_c_e +
", d_b_fitting_e_c=" + d_b_fitting_e_c +
", d_b_fitting_type=" + d_b_fitting_type +
", d_b_fitting_type_def='" + d_b_fitting_type_def + '\'' +
", d_g_fitting_e_c=" + d_g_fitting_e_c +
", d_g_fitting_type=" + d_g_fitting_type +
", d_g_fitting_type_def='" + d_g_fitting_type_def + '\'' +
", d_b_fitting_c_e=" + d_b_fitting_c_e +
", d_g_fitting_c_e=" + d_g_fitting_c_e +
", S_ROI=" + S_ROI +
", S_ROI_B_Boundary_start=" + S_ROI_B_Boundary_start +
", S_ROI_B_Boundary_stop=" + S_ROI_B_Boundary_stop +
@ -178,5 +188,4 @@ public class BgAnalyseResult {
", error_log='" + error_log + '\'' +
'}';
}
}

View File

@ -72,6 +72,6 @@ public interface ISpectrumAnalysisService {
Result analyseAllSpectrum(List<String> dbNames, List<Integer> sampleIds, List<String> sampleFileNames, List<String> gasFileNames, List<String> detFileNames, HttpServletRequest request);
Result saveToDB(BgDataAnlyseResultIn anlyseResultIn);
Result saveToDB(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request);
}

View File

@ -1222,9 +1222,9 @@ public class GammaServiceImpl implements IGammaService {
for (int i=0; i<m_vCurCentroid.size(); i++) {
strBuffer.append(m_vCurEnergy.get(i)).append(" ").append(m_vCurCentroid.get(i)).append(" ").append(m_vCurUncert.get(i)).append("\n");
}
FileOutputStream fos = null;
OutputStream fos = null;
try {
fos = new FileOutputStream(new File("文件名"));
fos = response.getOutputStream();
fos.write(strBuffer.toString().getBytes());
} catch (FileNotFoundException e) {
throw new RuntimeException(e);

View File

@ -1330,7 +1330,14 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
String export = "RLR-Beta.xls";
String template = RLR_B.getName();
ExportUtil.exportXls(response, template, dataMap, export);
ExportUtil.exportXls(response, template, dataMap,export);
}
public static void main(String[] args) {
BetaRLR betaRLR = new BetaRLR();
Map<String,Object> dataMap = BeanUtil.beanToMap(betaRLR);
dataMap.replaceAll((key, value) -> ObjectUtil.isNull(value) ? "" : value);
dataMap.forEach((key, value) -> System.out.println(key + "---" + value));
}
@Override
@ -2639,9 +2646,10 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
@Override
@Transactional
public Result saveToDB(BgDataAnlyseResultIn anlyseResultIn) {
public Result saveToDB(BgDataAnlyseResultIn anlyseResultIn, HttpServletRequest request) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
String userName = JwtUtil.getUserNameByToken(request);
anlyseResultIn.setUserName(userName);
String beginDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
String endDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
//判断当前分析员是否有过排班任务
@ -2655,10 +2663,43 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
getChannelAndEnergy(anlyseResultIn);
//获取ROI Limit数据
// getROILimit(anlyseResultIn);
//根据sample文件名称模糊查询sampleId
if (StringUtils.isNotBlank(anlyseResultIn.getDbName())) {
if (anlyseResultIn.getDbName().equals("auto")) {
anlyseResultIn.setDbName("RNAUTO");
} else if (anlyseResultIn.getDbName().equals("man")) {
anlyseResultIn.setDbName("RNMAN");
}
Integer sampleId = spectrumAnalysisMapper.getSampleIdLikeFileName(anlyseResultIn.getSampleFileName());
if (Objects.nonNull(sampleId)) {
SpectrumFileRecord dbSpectrumFilePath = spectrumAnalysisMapper.getDBSpectrumFilePath(anlyseResultIn.getDbName(), sampleId);
if (StringUtils.isNotBlank(dbSpectrumFilePath.getSampleFilePath())){
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getSampleFilePath().substring(0, dbSpectrumFilePath.getSampleFilePath().lastIndexOf(StringPool.SLASH)));
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getGasBgFilePath())) {
anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getGasBgFilePath().substring(0, dbSpectrumFilePath.getGasBgFilePath().lastIndexOf(StringPool.SLASH)));
}
if (StringUtils.isNotBlank(dbSpectrumFilePath.getDetBgFilePath())) {
anlyseResultIn.setDetFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + dbSpectrumFilePath.getDetBgFilePath().substring(0, dbSpectrumFilePath.getDetBgFilePath().lastIndexOf(StringPool.SLASH)));
}
if ( Objects.nonNull(dbSpectrumFilePath.getCollectStart()) && StringUtils.isNotBlank(dbSpectrumFilePath.getSiteDetCode()) ) {
String collectStartStr = DateUtils.formatDate(dbSpectrumFilePath.getCollectStart(), "yyyy/MM/dd HH:mm:ss");
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + spectrumAnalysisMapper.getQCFilePath(dbSpectrumFilePath.getSiteDetCode(), collectStartStr));
}
}
} else {
anlyseResultIn.setSampleFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setGasFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setDetFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
anlyseResultIn.setQcFilePath(StringPool.SLASH + spectrumPathProperties.getUploadPath() + StringPool.SLASH + userName);
}
//处理文件名称
String sampleFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
String gasFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
String detFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
String qcFilePathName = phdFileUtil.NameStandardBy(anlyseResultIn.getQcFilePath(), anlyseResultIn.getQcFileName());
//判断文件是否存储过 如果没有则解析文件并进行存储
if ( !OriginalDataStore(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName(), gasFilePathName, anlyseResultIn.getUserName()) ){
result.error500("gasFile save failed");
@ -2668,6 +2709,12 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
result.error500("detFile save failed");
return result;
}
if (StringUtils.isNotBlank(anlyseResultIn.getQcFileName())) {
if ( !OriginalDataStore(anlyseResultIn.getQcFilePath(), anlyseResultIn.getQcFileName(), qcFilePathName, anlyseResultIn.getUserName()) ){
result.error500("qcFile save failed");
return result;
}
}
if ( !OriginalDataStore(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName(), sampleFilePathName, anlyseResultIn.getUserName()) ){
result.error500("sampleFile save failed");
return result;
@ -2707,11 +2754,15 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (Objects.nonNull(isExist)){
//根据idAnalysis删除GARDS_CALIBRATION_PAIRS表数据
spectrumAnalysisMapper.deleteCalibrationPairs(idAnalysis);
//新增GARDS_CALIBRATION_PAIRS表数据
spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairsList);
//遍历新增GARDS_CALIBRATION_PAIRS表数据
for (GardsCalibrationPairs calibrationPairs:calibrationPairsList) {
spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairs);
}
}else {//如果没有分析过--新增GARDS_CALIBRATION_PAIRS表数据
//新增GARDS_CALIBRATION_PAIRS表数据
spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairsList);
//遍历新增GARDS_CALIBRATION_PAIRS表数据
for (GardsCalibrationPairs calibrationPairs:calibrationPairsList) {
spectrumAnalysisMapper.insertCalibrationPairs(calibrationPairs);
}
}
//gards_calibration 数据表
List<GardsCalibration> calibrationList = getCalibration(anlyseResultIn, sampleId, gasId, detId, idAnalysis);
@ -2719,11 +2770,15 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
if (Objects.nonNull(isExist)) {
//删除Gards_Calibration表数据
spectrumAnalysisMapper.deleteCalibration(idAnalysis);
//新增数据
calibrationSpectrumService.saveGardsCalibration(calibrationList);
//新增Gards_Calibration表数据数据
for (GardsCalibration calibration:calibrationList) {
spectrumAnalysisMapper.insertCalibration(calibration);
}
} else {
//新增数据
calibrationSpectrumService.saveGardsCalibration(calibrationList);
//新增Gards_Calibration表数据数据
for (GardsCalibration calibration:calibrationList) {
spectrumAnalysisMapper.insertCalibration(calibration);
}
}
//gards_roi_channels数据表
List<GardsRoiChannels> roiChannelsList = new LinkedList<>();
@ -2735,21 +2790,29 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
//删除gards_roi_channels数据表数据
spectrumAnalysisMapper.deleteROIChannels(idAnalysis);
//新增gards_roi_channels数据表数据
roiChannelsSpectrumService.saveGardsROIChannels(roiChannelsList);
for (GardsRoiChannels roiChannels:roiChannelsList) {
spectrumAnalysisMapper.insertROIChannels(roiChannels);
}
}else {//没有分析过
//新增gards_roi_channels数据表数据
roiChannelsSpectrumService.saveGardsROIChannels(roiChannelsList);
for (GardsRoiChannels roiChannels:roiChannelsList) {
spectrumAnalysisMapper.insertROIChannels(roiChannels);
}
}
//gards_Xe_results数据表
List<GardsXeResults> xeResults = getXeResults(anlyseResultIn, sampleId, idAnalysis);
List<GardsXeResults> xeResultsList = getXeResults(anlyseResultIn, sampleId, idAnalysis);
if(Objects.nonNull(isExist)) {
//删除gards_Xe_results数据表数据
spectrumAnalysisMapper.deleteXeResult(idAnalysis);
//新增gards_Xe_results数据表数据
xeResultsSpectrumService.saveGardsXeResults(xeResults);
for (GardsXeResults xeResults:xeResultsList) {
spectrumAnalysisMapper.insertXeResult(xeResults);
}
} else {
//新增gards_Xe_results数据表数据
xeResultsSpectrumService.saveGardsXeResults(xeResults);
for (GardsXeResults xeResults:xeResultsList) {
spectrumAnalysisMapper.insertXeResult(xeResults);
}
}
//gards_roi_results数据表
List<GardsRoiResults> roiResultsSpectrumList = getROIResult(anlyseResultIn.getRoiResultsSpectrumList(), sampleId, idAnalysis, isExist);
@ -2757,10 +2820,25 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
//删除gards_roi_results数据表数据
spectrumAnalysisMapper.deleteROIResults(idAnalysis);
//新增gards_roi_results数据表数据
roiResultsSpectrumService.saveGardsROIResults(roiResultsSpectrumList);
for (GardsRoiResults roiResults:roiResultsSpectrumList) {
spectrumAnalysisMapper.insertROIResults(roiResults);
}
} else {
//新增gards_roi_results数据表数据
roiResultsSpectrumService.saveGardsROIResults(roiResultsSpectrumList);
for (GardsRoiResults roiResults:roiResultsSpectrumList) {
spectrumAnalysisMapper.insertROIResults(roiResults);
}
}
//上传本次文件到ftp人工交互存储路径下
File sampleTmp = phdFileUtil.analyzeFile(anlyseResultIn.getSampleFilePath(), anlyseResultIn.getSampleFileName());
File gasTmp = phdFileUtil.analyzeFile(anlyseResultIn.getGasFilePath(), anlyseResultIn.getGasFileName());
File detTmp = phdFileUtil.analyzeFile(anlyseResultIn.getDetFilePath(), anlyseResultIn.getDetFileName());
try {
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + sampleFilePathName.substring(0, sampleFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getSampleFileName(), new FileInputStream(sampleTmp));
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + gasFilePathName.substring(0, gasFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getGasFileName(), new FileInputStream(gasTmp));
ftpUtil.saveFile(StringPool.SLASH + spectrumPathProperties.getRootPath() + StringPool.SLASH + detFilePathName.substring(0, detFilePathName.lastIndexOf(StringPool.SLASH)), anlyseResultIn.getDetFileName(), new FileInputStream(detTmp));
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
result.setSuccess(true);
return result;
@ -3072,7 +3150,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
GardsRoiChannels roiChannels = new GardsRoiChannels();
roiChannels.setSampleId(sampleId);
roiChannels.setIdAnalysis(idAnalysis);
roiChannels.setRoi(i);
roiChannels.setRoi(i+1);
roiChannels.setBChanStart(roiChannelsSpectrumList.get(i).getBChanStart());
roiChannels.setBChanStop(roiChannelsSpectrumList.get(i).getBChanStop());
roiChannels.setGChanStart(roiChannelsSpectrumList.get(i).getGChanStart());
@ -3090,8 +3168,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
xe131m.setConc(anlyseResultIn.getXe131m_con());
xe131m.setConcErr(anlyseResultIn.getXe131m_uncer());
xe131m.setMdc(anlyseResultIn.getMDC_Xe131m());
xe131m.setLc(anlyseResultIn.getLC_Xe131m());
xe131m.setMdc(anlyseResultIn.getMdc_Xe131m());
xe131m.setLc(anlyseResultIn.getLc_Xe131m());
xe131m.setNidFlag(anlyseResultIn.getXe131mFlag());
xeResultsList.add(xe131m);
//Xe133
@ -3101,8 +3179,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
xe133.setNuclideName(XeNuclideName.XE_133.getType());
xe133.setConc(anlyseResultIn.getXe133_con());
xe133.setConcErr(anlyseResultIn.getXe133_uncer());
xe133.setMdc(anlyseResultIn.getMDC_Xe133());
xe133.setLc(anlyseResultIn.getLC_Xe133());
xe133.setMdc(anlyseResultIn.getMdc_Xe133());
xe133.setLc(anlyseResultIn.getLc_Xe133());
xe133.setNidFlag(anlyseResultIn.getXe133Flag());
xeResultsList.add(xe133);
//Xe133m
@ -3112,8 +3190,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
xe133m.setConc(anlyseResultIn.getXe133m_con());
xe133m.setConcErr(anlyseResultIn.getXe133m_uncer());
xe133m.setMdc(anlyseResultIn.getMDC_Xe133m());
xe133m.setLc(anlyseResultIn.getLC_Xe133m());
xe133m.setMdc(anlyseResultIn.getMdc_Xe133m());
xe133m.setLc(anlyseResultIn.getLc_Xe133m());
xe133m.setNidFlag(anlyseResultIn.getXe133mFlag());
xeResultsList.add(xe133m);
//Xe135
@ -3123,8 +3201,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
xe135.setNuclideName(XeNuclideName.XE_135.getType());
xe135.setConc(anlyseResultIn.getXe135_con());
xe135.setConcErr(anlyseResultIn.getXe135_uncer());
xe135.setMdc(anlyseResultIn.getMDC_Xe135());
xe135.setLc(anlyseResultIn.getLC_Xe135());
xe135.setMdc(anlyseResultIn.getMdc_Xe135());
xe135.setLc(anlyseResultIn.getLc_Xe135());
xe135.setNidFlag(anlyseResultIn.getXe135Flag());
xeResultsList.add(xe135);
return xeResultsList;
@ -3139,8 +3217,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
xe131m.setNuclideName(XeNuclideName.XE_131m.getType());
xe131m.setConc(anlyseResultIn.getXe131m_con());
xe131m.setConcErr(anlyseResultIn.getXe131m_uncer());
xe131m.setMdc(anlyseResultIn.getMDC_Xe131m());
xe131m.setLc(anlyseResultIn.getLC_Xe131m());
xe131m.setMdc(anlyseResultIn.getMdc_Xe131m());
xe131m.setLc(anlyseResultIn.getLc_Xe131m());
xe131m.setNidFlag(anlyseResultIn.getXe131mFlag());
xeResultsList.add(xe131m);
//Xe133
@ -3150,8 +3228,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
xe133.setNuclideName(XeNuclideName.XE_133.getType());
xe133.setConc(anlyseResultIn.getXe133_con());
xe133.setConcErr(anlyseResultIn.getXe133_uncer());
xe133.setMdc(anlyseResultIn.getMDC_Xe133());
xe133.setLc(anlyseResultIn.getLC_Xe133());
xe133.setMdc(anlyseResultIn.getMdc_Xe133());
xe133.setLc(anlyseResultIn.getLc_Xe133());
xe133.setNidFlag(anlyseResultIn.getXe133Flag());
xeResultsList.add(xe133);
//Xe133m
@ -3161,8 +3239,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
xe133m.setNuclideName(XeNuclideName.XE_133m.getType());
xe133m.setConc(anlyseResultIn.getXe133m_con());
xe133m.setConcErr(anlyseResultIn.getXe133m_uncer());
xe133m.setMdc(anlyseResultIn.getMDC_Xe133m());
xe133m.setLc(anlyseResultIn.getLC_Xe133m());
xe133m.setMdc(anlyseResultIn.getMdc_Xe133m());
xe133m.setLc(anlyseResultIn.getLc_Xe133m());
xe133m.setNidFlag(anlyseResultIn.getXe133mFlag());
xeResultsList.add(xe133m);
//Xe135
@ -3172,8 +3250,8 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
xe135.setNuclideName(XeNuclideName.XE_135.getType());
xe135.setConc(anlyseResultIn.getXe135_con());
xe135.setConcErr(anlyseResultIn.getXe135_uncer());
xe135.setMdc(anlyseResultIn.getMDC_Xe135());
xe135.setLc(anlyseResultIn.getLC_Xe135());
xe135.setMdc(anlyseResultIn.getMdc_Xe135());
xe135.setLc(anlyseResultIn.getLc_Xe135());
xe135.setNidFlag(anlyseResultIn.getXe135Flag());
xeResultsList.add(xe135);
return xeResultsList;
@ -3305,7 +3383,7 @@ public class SpectrumAnalysisServiceImpl implements ISpectrumAnalysisService {
GardsRoiResults roiResults = new GardsRoiResults();
roiResults.setSampleId(sampleId);
roiResults.setIdAnalysis(idAnalysis);
roiResults.setRoi(i);
roiResults.setRoi(i+1);
roiResults.setLc(roiResultsSpectrumList.get(i).getLc());
roiResults.setSGross(roiResultsSpectrumList.get(i).getSGross());
roiResults.setGGross(roiResultsSpectrumList.get(i).getGGross());